gcblue-commits Mailing List for Global Conflict Blue (Page 36)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
| 2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
| 2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:51
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058/src/graphics Modified Files: ObjectUpdater.cpp tc3DModel.cpp tc3DViewer.cpp tcButton.cpp tcCreditView.cpp tcMapView.cpp tcOOBView.cpp tcParticleEffect.cpp tcScenarioSelectView.cpp tcSmoker.cpp tcStartView.cpp Log Message: Multiple smoke trail fixes Animation tweaks Index: tcStartView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStartView.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcStartView.cpp 2 Nov 2004 04:23:56 -0000 1.5 --- tcStartView.cpp 27 Jan 2005 01:01:51 -0000 1.6 *************** *** 185,189 **** return; } ! //tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } --- 185,189 ---- return; } ! //tcSound::Get()->PlayEffect("Beep2"); } *************** *** 195,199 **** if ((maButton[i].mnState == 0)&&(bButtonEnabled)) { ! tcSound::Get()->PlayEffect(SEFFECT_THUCK); } if (bButtonEnabled) {maButton[i].mnState = 1;} --- 195,199 ---- if ((maButton[i].mnState == 0)&&(bButtonEnabled)) { ! tcSound::Get()->PlayEffect("Thuck"); } if (bButtonEnabled) {maButton[i].mnState = 1;} *************** *** 231,235 **** if (nButton != 2) { ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } int command_id; --- 231,235 ---- if (nButton != 2) { ! tcSound::Get()->PlayEffect("Beep2"); } int command_id; Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tc3DModel.cpp 16 Jan 2005 18:36:29 -0000 1.20 --- tc3DModel.cpp 27 Jan 2005 01:01:48 -0000 1.21 *************** *** 2,6 **** ** @file tc3DModel.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tc3DModel.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 33,36 **** --- 33,37 ---- #include "tcParticleEffect.h" #include "tcParticlePlacer.h" + #include "tcSound.h" #include "tcGenericDBObject.h" #include "common/tinyxml.h" *************** *** 40,43 **** --- 41,48 ---- #include <osgUtil/SmoothingVisitor> + #include <osgAL/SoundNode> + #include <osgAL/SoundRoot> + #include <osgAL/SoundManager> + #include <osgAL/SoundState> #ifdef _DEBUG *************** *** 412,415 **** --- 417,422 ---- std::cout << "Load of 3D model: " << model_name << " failed.\n"; std::cerr << "Load of 3D model: " << model_name << " failed.\n"; + + modelNode = unknownAll.get(); // use unknown model as default } *************** *** 700,703 **** --- 707,712 ---- : distanceFromCamera(1e10) { + static int addCount = 0; + wxASSERT(source->modelNode.valid()); // error if modelNode not loaded yet wxASSERT(unknownAll.valid()); *************** *** 709,712 **** --- 718,737 ---- modelTransform->addChild(root.get()); + try + { + if (addCount < 0) + { + soundNode = tcSound::Get()->CreateSound("helolaunch.wav"); + modelTransform->addChild(soundNode.get()); + addCount++; + } + } + catch (...) + { + fprintf(stderr, "Failed to load sound file\n"); + } + + + modelGroup = new osg::LOD; Index: tcSmoker.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcSmoker.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSmoker.cpp 16 Jan 2005 18:36:29 -0000 1.1 --- tcSmoker.cpp 27 Jan 2005 01:01:50 -0000 1.2 *************** *** 36,39 **** --- 36,65 ---- + + tcSmokeTrail& tcSmokeTrail::operator= (const tcSmokeTrail& rhs) + { + smokeEffect = rhs.smokeEffect; + smokePlacer = rhs.smokePlacer; + smokeSource = rhs.smokeSource; + + return *this; + } + + tcSmokeTrail::tcSmokeTrail() + { + } + + tcSmokeTrail::tcSmokeTrail(const tcSmokeTrail& source) + { + smokeEffect = source.smokeEffect; + smokePlacer = source.smokePlacer; + smokeSource = source.smokeSource; + } + + tcSmokeTrail::~tcSmokeTrail() + { + } + + osg::ref_ptr<osg::Group> tcSmoker::world; *************** *** 51,60 **** void tcSmoker::AddSmokeTrail(const osg::Vec3& smokeSource, int smokeMode) { ! tcSmokeTrail trail; ! trail.smokeEffect = new tcParticleEffect(smokeMode); ! trail.smokeEffect->AddToSceneGraph(world.get()); ! trail.smokePlacer = trail.smokeEffect->GetParticlePlacer(); ! trail.smokeSource = smokeSource; smokeTrails.push_back(trail); --- 77,86 ---- void tcSmoker::AddSmokeTrail(const osg::Vec3& smokeSource, int smokeMode) { ! osg::ref_ptr<tcSmokeTrail> trail = new tcSmokeTrail; ! trail->smokeEffect = new tcParticleEffect(smokeMode); ! trail->smokeEffect->AddToSceneGraph(world.get()); ! trail->smokePlacer = trail->smokeEffect->GetParticlePlacer(); ! trail->smokeSource = smokeSource; smokeTrails.push_back(trail); *************** *** 69,75 **** for (size_t n=0; n<nSmoke; n++) { ! tcSmokeTrail& trail = smokeTrails[n]; ! trail.smokeEffect->DetachFromSceneGraph(); ! delete trail.smokeEffect; } smokeTrails.clear(); --- 95,104 ---- for (size_t n=0; n<nSmoke; n++) { ! //smokeTrails[n]->smokeEffect->DetachFromSceneGraph(); ! smokeTrails[n]->smokeEffect->PreDestroy(); ! // delete smokeTrails[n]->smokeEffect.release(); // necessary? ! // delete smokeTrails[n]->smokePlacer.release(); ! // delete smokeTrails[n].release(); ! } smokeTrails.clear(); *************** *** 118,129 **** for (size_t n=0; n<nSmoke; n++) { ! tcSmokeTrail& trail = smokeTrails[n]; ! wxASSERT(trail.smokePlacer); ! if (trail.smokePlacer == 0) return; ! osg::Vec3 smokeOffset = rotation * trail.smokeSource; osg::Vec3 offsetPos = pos + smokeOffset; ! trail.smokePlacer->setCenter(offsetPos.x(), offsetPos.y(), offsetPos.z()); } --- 147,157 ---- for (size_t n=0; n<nSmoke; n++) { ! wxASSERT(smokeTrails[n]->smokePlacer.valid()); ! if (!smokeTrails[n]->smokePlacer.valid()) return; ! osg::Vec3 smokeOffset = rotation * smokeTrails[n]->smokeSource; osg::Vec3 offsetPos = pos + smokeOffset; ! smokeTrails[n]->smokePlacer->setCenter(offsetPos.x(), offsetPos.y(), offsetPos.z()); } *************** *** 143,145 **** --- 171,174 ---- tcSmoker::~tcSmoker() { + DeleteTrails(); } Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcCreditView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcCreditView.cpp 5 Dec 2004 02:49:47 -0000 1.10 --- tcCreditView.cpp 27 Jan 2005 01:01:49 -0000 1.11 *************** *** 215,219 **** //mpBrush->SetColor(Color(255,255,255,255)); //pGraphics->FillRectangle(mpBrush,0,0,mnWidth,mnHeight); ! //tcSound::Get()->PlayEffect(SEFFECT_EXPLOSION2); } if (nFlashId >= 0) --- 215,219 ---- //mpBrush->SetColor(Color(255,255,255,255)); //pGraphics->FillRectangle(mpBrush,0,0,mnWidth,mnHeight); ! //tcSound::Get()->PlayEffect("Explosion2"); } if (nFlashId >= 0) Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcOOBView.cpp 11 Dec 2004 01:09:06 -0000 1.6 --- tcOOBView.cpp 27 Jan 2005 01:01:50 -0000 1.7 *************** *** 652,656 **** mnSelectedKey = new_key; ! tcSound::Get()->PlayEffect(SEFFECT_SHORTBEEP); mbMouseDrag = true; --- 652,656 ---- mnSelectedKey = new_key; ! tcSound::Get()->PlayEffect("ShortBeep"); mbMouseDrag = true; *************** *** 673,677 **** msFormationChangeInfo.mbApply = true; ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } } --- 673,677 ---- msFormationChangeInfo.mbApply = true; ! tcSound::Get()->PlayEffect("Beep2"); } } Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcScenarioSelectView.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcScenarioSelectView.cpp 14 Nov 2004 22:52:21 -0000 1.8 --- tcScenarioSelectView.cpp 27 Jan 2005 01:01:50 -0000 1.9 *************** *** 329,338 **** { item.drawState = scenarioInfo::ON; ! if (item.drawState != oldState) tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else if (r.Inside(mousePosition)) { item.drawState = scenarioInfo::OVER; ! if (item.drawState != oldState) tcSound::Get()->PlayEffect(SEFFECT_THUCK); } else --- 329,338 ---- { item.drawState = scenarioInfo::ON; ! if (item.drawState != oldState) tcSound::Get()->PlayEffect("Beep2"); } else if (r.Inside(mousePosition)) { item.drawState = scenarioInfo::OVER; ! if (item.drawState != oldState) tcSound::Get()->PlayEffect("Thuck"); } else Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcMapView.cpp 10 Jan 2005 00:30:54 -0000 1.14 --- tcMapView.cpp 27 Jan 2005 01:01:49 -0000 1.15 *************** *** 2151,2155 **** { SetViewCenterZoom(buttonDownPoint, 1.5f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; } --- 2151,2155 ---- { SetViewCenterZoom(buttonDownPoint, 1.5f); ! tcSound::Get()->PlayEffect("Beep2"); return; } *************** *** 2157,2161 **** { SetViewCenterZoom(buttonDownPoint, 1.0f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; } --- 2157,2161 ---- { SetViewCenterZoom(buttonDownPoint, 1.0f); ! tcSound::Get()->PlayEffect("Beep2"); return; } *************** *** 2227,2231 **** { SetViewCenterZoom(point,0.7f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; // old returned true } --- 2227,2231 ---- { SetViewCenterZoom(point,0.7f); ! tcSound::Get()->PlayEffect("Beep2"); return; // old returned true } *************** *** 2285,2294 **** { SetViewCenterZoom(point,2.0f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else if (zDelta < 0) { SetViewCenterZoom(point,0.5f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } } --- 2285,2294 ---- { SetViewCenterZoom(point,2.0f); ! tcSound::Get()->PlayEffect("Beep2"); } else if (zDelta < 0) { SetViewCenterZoom(point,0.5f); ! tcSound::Get()->PlayEffect("Beep2"); } } *************** *** 2596,2605 **** if (event.ControlDown() && event.ShiftDown()) { ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); tcPoint geoPoint = ScreenToGeo(point); // geopoint (lon,lat) in radians ChangeTheater(C_180OVERPI * geoPoint.x, C_180OVERPI * geoPoint.y); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else if (event.ControlDown()) --- 2596,2605 ---- if (event.ControlDown() && event.ShiftDown()) { ! tcSound::Get()->PlayEffect("Beep2"); tcPoint geoPoint = ScreenToGeo(point); // geopoint (lon,lat) in radians ChangeTheater(C_180OVERPI * geoPoint.x, C_180OVERPI * geoPoint.y); ! tcSound::Get()->PlayEffect("Beep2"); } else if (event.ControlDown()) *************** *** 2608,2612 **** { SetViewCenterZoom(point,2.0f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } } --- 2608,2612 ---- { SetViewCenterZoom(point,2.0f); ! tcSound::Get()->PlayEffect("Beep2"); } } *************** *** 2614,2618 **** { SetViewCenterZoom(point,1.0f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else --- 2614,2618 ---- { SetViewCenterZoom(point,1.0f); ! tcSound::Get()->PlayEffect("Beep2"); } else *************** *** 2628,2632 **** { SetViewCenterZoom(point,0.5f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } } --- 2628,2632 ---- { SetViewCenterZoom(point,0.5f); ! tcSound::Get()->PlayEffect("Beep2"); } } Index: tcButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcButton.cpp 21 Dec 2004 02:26:17 -0000 1.16 --- tcButton.cpp 27 Jan 2005 01:01:49 -0000 1.17 *************** *** 217,221 **** isButtonOn = false; isMouseOver = false; ! soundEffect = 19; fontSize = 12.0f; sendRedraw = false; --- 217,221 ---- isButtonOn = false; isMouseOver = false; ! soundEffect = "MutedBeep"; fontSize = 12.0f; sendRedraw = false; *************** *** 299,303 **** isButtonOn = false; isMouseOver = false; ! soundEffect = -1; fontSize = 16.0f; sendRedraw = false; --- 299,303 ---- isButtonOn = false; isMouseOver = false; ! soundEffect = ""; fontSize = 16.0f; sendRedraw = false; Index: tcParticleEffect.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcParticleEffect.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcParticleEffect.cpp 21 Dec 2004 02:26:17 -0000 1.7 --- tcParticleEffect.cpp 27 Jan 2005 01:01:50 -0000 1.8 *************** *** 296,301 **** --- 296,303 ---- if (!root) { + #ifdef _DEBUG fprintf(stderr, "Warning - tcParticleEffect already removed from scene graph," "skipping\n"); + #endif return; } *************** *** 349,352 **** --- 351,385 ---- } + /** + * Workaround for circular references with ref_ptr + * Call before deleting + */ + void tcParticleEffect::PreDestroy() + { + if (emitter.valid()) + { + emitter->setParticleSystem(0); + } + + if (program.valid()) + { + program->setParticleSystem(0); + } + + if (program.valid()) + { + program->setParticleSystem(0); + } + + if (updater.valid()) + { + updater->removeParticleSystem(this); + } + + if (geode.valid()) + { + geode->removeDrawable(this); + } + } tcParticleEffect::tcParticleEffect(int smokeModeCode) *************** *** 419,422 **** --- 452,456 ---- tcParticleEffect::~tcParticleEffect() { + if (root) DetachFromSceneGraph(); } Index: ObjectUpdater.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/ObjectUpdater.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ObjectUpdater.cpp 16 Jan 2005 18:36:29 -0000 1.12 --- ObjectUpdater.cpp 27 Jan 2005 01:01:48 -0000 1.13 *************** *** 87,91 **** if (info.animationType == 0) { ! angle *= gameObject->mcKin.mfSpeed_kts; } --- 87,97 ---- if (info.animationType == 0) { ! /* for subs and surface ships change rate with speed (omega is radians per second per knot) ! ** aircraft including helos use a fixed rate (omega is radians per second) ! */ ! if (gameObject->mcKin.mfSpeed_kts < 50.0f) ! { ! angle *= gameObject->mcKin.mfSpeed_kts; ! } } Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tc3DViewer.cpp 21 Dec 2004 02:26:17 -0000 1.8 --- tc3DViewer.cpp 27 Jan 2005 01:01:49 -0000 1.9 *************** *** 50,53 **** --- 50,57 ---- #include <osgUtil/UpdateVisitor> + #include <osgAL/SoundNode> + #include <osgAL/SoundRoot> + #include <osgAL/SoundManager> + #include <osgAL/SoundState> *************** *** 1058,1061 **** --- 1062,1068 ---- sceneViewFar->setViewMatrixAsLookAt(cameraPosition, cameraTarget, osg::Vec3(0,0,1)); + osgAL::SoundManager::instance()->getListener()->setPosition(cameraPosition.x(), cameraPosition.y(), + cameraPosition.z()); + // update skyTransform based on camera position skyTransform->asPositionAttitudeTransform()-> *************** *** 1871,1874 **** --- 1878,1883 ---- tc3DModel::LoadUnknowns(); + + rootnode->addChild(tcSound::Get()->GetSoundRoot()); } |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:47
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058/xml Modified Files: options.xml Log Message: Multiple smoke trail fixes Animation tweaks Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** options.xml 28 Dec 2004 23:51:26 -0000 1.11 --- options.xml 27 Jan 2005 01:02:07 -0000 1.12 *************** *** 2,9 **** <HostAddress>192.168.0.102</HostAddress> <DisplaySettings>default</DisplaySettings> ! <LastScenarioPath>Test.SurfAir.py</LastScenarioPath> ! <LastScenarioName>SurfAir</LastScenarioName> <xCopyDatabase /> <xWriteXmlDatabase /> ! <xLog3DModelDetails /> </Options> --- 2,9 ---- <HostAddress>192.168.0.102</HostAddress> <DisplaySettings>default</DisplaySettings> ! <LastScenarioPath>Test.SubTestII.py</LastScenarioPath> ! <LastScenarioName>SubTestII</LastScenarioName> <xCopyDatabase /> <xWriteXmlDatabase /> ! <Log3DModelDetails /> </Options> |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:37
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058/include/graphics Modified Files: tc3DModel.h tcButton.h tcParticleEffect.h tcSmoker.h Log Message: Multiple smoke trail fixes Animation tweaks Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tc3DModel.h 16 Jan 2005 18:35:57 -0000 1.11 --- tc3DModel.h 27 Jan 2005 01:01:44 -0000 1.12 *************** *** 41,44 **** --- 41,49 ---- } + namespace osgAL + { + class SoundNode; + } + /** * animation description stored in CSV database entry *************** *** 128,131 **** --- 133,140 ---- osg::ref_ptr<osg::MatrixTransform> modelTransform; ///< positions object in world, not shared osg::ref_ptr<osg::Node> modelNode; ///< shared between instances of model + + // osgAL sound node for 3D sound + osg::ref_ptr<osgAL::SoundNode> soundNode; + static osg::ref_ptr<osg::Group> world; Index: tcSmoker.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcSmoker.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSmoker.h 16 Jan 2005 18:35:57 -0000 1.1 --- tcSmoker.h 27 Jan 2005 01:01:45 -0000 1.2 *************** *** 45,54 **** * */ ! class tcSmokeTrail { public: ! tcParticleEffect* smokeEffect; ! osgParticle::tcParticlePlacer* smokePlacer; osg::Vec3 smokeSource; ///< position of smoke emitter in model coordinates }; --- 45,60 ---- * */ ! class tcSmokeTrail : public osg::Referenced { public: ! osg::ref_ptr<tcParticleEffect> smokeEffect; ! osg::ref_ptr<osgParticle::tcParticlePlacer> smokePlacer; osg::Vec3 smokeSource; ///< position of smoke emitter in model coordinates + + tcSmokeTrail& operator= (const tcSmokeTrail& rhs); + + tcSmokeTrail(); + tcSmokeTrail(const tcSmokeTrail& source); + virtual ~tcSmokeTrail(); }; *************** *** 72,76 **** private: ! std::vector<tcSmokeTrail> smokeTrails; tcGameObject *gameObj; ///< game object to use to update model state --- 78,82 ---- private: ! std::vector<osg::ref_ptr<tcSmokeTrail> > smokeTrails; tcGameObject *gameObj; ///< game object to use to update model state Index: tcParticleEffect.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcParticleEffect.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcParticleEffect.h 23 Nov 2004 23:30:46 -0000 1.4 --- tcParticleEffect.h 27 Jan 2005 01:01:44 -0000 1.5 *************** *** 62,65 **** --- 62,66 ---- void AddToSceneGraph(osg::Group* rootGroup); void DetachFromSceneGraph(); + void PreDestroy(); tcParticleEffect(int smokeModeCode); Index: tcButton.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcButton.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcButton.h 21 Dec 2004 02:26:17 -0000 1.11 --- tcButton.h 27 Jan 2005 01:01:44 -0000 1.12 *************** *** 60,64 **** void SetOn(bool state) {isButtonOn = state;} void SetSendRedraw(bool state) {sendRedraw = state;} ! void SetSoundEffect(int effect) {soundEffect = effect;} tcButton(tc3DWindow *parent, const wxPoint& pos, const wxSize& size, --- 60,64 ---- void SetOn(bool state) {isButtonOn = state;} void SetSendRedraw(bool state) {sendRedraw = state;} ! void SetSoundEffect(const std::string& effect) {soundEffect = effect;} tcButton(tc3DWindow *parent, const wxPoint& pos, const wxSize& size, *************** *** 72,76 **** bool isButtonOn; bool isMouseOver; ! int soundEffect; float fontSize; bool sendRedraw; ///< true to send redraw message to parent on button state change --- 72,76 ---- bool isButtonOn; bool isMouseOver; ! std::string soundEffect; float fontSize; bool sendRedraw; ///< true to send redraw message to parent on button state change |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:37
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058/src/scriptinterface Modified Files: tcScenarioInterface.cpp tcSubInterface.cpp Log Message: Multiple smoke trail fixes Animation tweaks Index: tcSubInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSubInterface.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSubInterface.cpp 23 Nov 2004 23:30:58 -0000 1.1 --- tcSubInterface.cpp 27 Jan 2005 01:01:52 -0000 1.2 *************** *** 103,107 **** messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect(SEFFECT_LOWBEEP); } --- 103,107 ---- messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); } *************** *** 124,128 **** messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect(SEFFECT_LOWBEEP); } --- 124,128 ---- messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); } *************** *** 144,148 **** messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect(SEFFECT_LOWBEEP); } --- 144,148 ---- messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); } *************** *** 164,168 **** messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect(SEFFECT_LOWBEEP); } --- 164,168 ---- messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); } Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcScenarioInterface.cpp 5 Dec 2004 02:49:48 -0000 1.15 --- tcScenarioInterface.cpp 27 Jan 2005 01:01:52 -0000 1.16 *************** *** 539,546 **** } ! void tcScenarioInterface::PlayEffect(int effectNumber) { wxASSERT(director); ! director->AddEvent(new tcSoundEffectEvent(eventTime,effectNumber)); } --- 539,546 ---- } ! void tcScenarioInterface::PlayEffect(const std::string& effectName) { wxASSERT(director); ! director->AddEvent(new tcSoundEffectEvent(eventTime, effectName)); } |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:36
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058/include/sim Modified Files: tcDirectorEvent.h Log Message: Multiple smoke trail fixes Animation tweaks Index: tcDirectorEvent.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcDirectorEvent.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcDirectorEvent.h 7 Oct 2004 22:01:12 -0000 1.11 --- tcDirectorEvent.h 27 Jan 2005 01:01:46 -0000 1.12 *************** *** 148,156 **** { public: ! int effectCode; virtual void Update(double t); ! tcSoundEffectEvent(double t, int effect); virtual ~tcSoundEffectEvent(); }; --- 148,156 ---- { public: ! std::string effectCode; virtual void Update(double t); ! tcSoundEffectEvent(double t, const std::string& effect); virtual ~tcSoundEffectEvent(); }; |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:29
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058/src/common Modified Files: tcOptionsView.cpp tcSound.cpp tcSoundConsole.cpp Log Message: Multiple smoke trail fixes Animation tweaks Index: tcSoundConsole.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSoundConsole.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcSoundConsole.cpp 7 Dec 2004 04:00:28 -0000 1.11 --- tcSoundConsole.cpp 27 Jan 2005 01:01:48 -0000 1.12 *************** *** 53,57 **** if (counter - lastEffect > 4) { ! tcSound::Get()->PlayEffect(mnSoundEffect); lastEffect = counter; } --- 53,57 ---- if (counter - lastEffect > 4) { ! tcSound::Get()->PlayEffect(soundEffect); lastEffect = counter; } *************** *** 79,83 **** void tcSoundConsole::Print(const char* line) { ! tcSound::Get()->PlayEffect(mnSoundEffect); textBox->Print(line); --- 79,83 ---- void tcSoundConsole::Print(const char* line) { ! tcSound::Get()->PlayEffect(soundEffect); textBox->Print(line); *************** *** 112,116 **** const wxString& name) : tcXmlWindow(parent, pos, size, configFile, name), ! mnSoundEffect(SEFFECT_CONSOLE), lastEffect(0) { --- 112,116 ---- const wxString& name) : tcXmlWindow(parent, pos, size, configFile, name), ! soundEffect("consolebeep"), lastEffect(0) { Index: tcOptionsView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptionsView.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcOptionsView.cpp 1 Nov 2004 03:17:17 -0000 1.13 --- tcOptionsView.cpp 27 Jan 2005 01:01:47 -0000 1.14 *************** *** 178,182 **** mpOptions->Serialize(false); // create new options file ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else --- 178,182 ---- mpOptions->Serialize(false); // create new options file ! tcSound::Get()->PlayEffect("Beep2"); } else Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcSound.cpp 10 Jan 2005 00:30:46 -0000 1.19 --- tcSound.cpp 27 Jan 2005 01:01:48 -0000 1.20 *************** *** 46,140 **** ! bool tcSound::GetMusicPause() const { ! wxASSERT(oggStreamer); ! return oggStreamer->GetPause(); ! } ! bool tcSound::Init() ! { ! int i; ! // ALuint moving_source = 0; ! ALfloat zeroes[] = { 0.0f, 0.0f, 0.0f }; ! // ALfloat back[] = { 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f }; ! ALfloat front[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }; ! // ALfloat position[] = { 0.0f, 0.0f, -4.0f }; ! alutInit(NULL,0); ! // Clear Error Code ! if (alGetError() != AL_NO_ERROR) ! { ! wxMessageBox("Error during OpenAL init. " ! "Sound driver may not support OpenAL.", "Warning", wxICON_WARNING); ! } ! alListenerfv(AL_POSITION, zeroes ); ! alListenerfv(AL_VELOCITY, zeroes ); ! alListenerfv(AL_ORIENTATION, front ); ! for(i=0;i<N_SEFFECT;i++) ! { ! alGenBuffers( 1, &BufferEffect[i]); ! if((alGetError())!=AL_NO_ERROR) ! { ! printf("error creating buffer %i",i); ! } ! } ! LoadWavDataFromFile("Explosion.wav",SEFFECT_EXPLOSION); ! LoadWavDataFromFile("Implosion.wav",SEFFECT_IMPLOSION); ! LoadWavDataFromFile("ShortBeep.wav",SEFFECT_SHORTBEEP); ! LoadWavDataFromFile("MissileLaunch.wav",SEFFECT_MISSILELAUNCH); ! LoadWavDataFromFile("TwoBeeps.wav",SEFFECT_TWOBEEPS); ! LoadWavDataFromFile("consolebeep.wav",SEFFECT_CONSOLE); ! LoadWavDataFromFile("Beep2.wav",SEFFECT_BEEP2); ! LoadWavDataFromFile("RejectBeep.wav",SEFFECT_REJECTBEEP); ! LoadWavDataFromFile("Ping.wav",SEFFECT_LIGHTSABER); ! LoadWavDataFromFile("Ping.wav",SEFFECT_PING); ! LoadWavDataFromFile("Ping2.wav",SEFFECT_PING2); ! LoadWavDataFromFile("radarping.wav",SEFFECT_PING3); ! LoadWavDataFromFile("LowBeep.wav",SEFFECT_LOWBEEP); ! LoadWavDataFromFile("Bloop.wav",SEFFECT_BLOOP); ! LoadWavDataFromFile("NoisyBeepLow.wav",SEFFECT_NOISYBEEP); ! LoadWavDataFromFile("Thuck.wav",SEFFECT_THUCK); ! LoadWavDataFromFile("Explosion2.wav",SEFFECT_EXPLOSION2); ! LoadWavDataFromFile("Welcome.wav",SEFFECT_WELCOME); ! LoadWavDataFromFile("jetlaunch.wav",SEFFECT_JETLAUNCH); ! LoadWavDataFromFile("MutedBeep.wav",SEFFECT_MUTEDBEEP); ! LoadWavDataFromFile("intercom.wav",SEFFECT_INTERCOM); ! LoadWavDataFromFile("fslide.wav",SEFFECT_FSLIDE); ! LoadWavDataFromFile("NavalGun1.wav", SEFFECT_NAVALGUN); ! LoadWavDataFromFile("helolaunch.wav", SEFFECT_HELOLAUNCH); ! LoadWavDataFromFile("radar_on.wav", SEFFECT_RADARON); ! LoadWavDataFromFile("radar_off.wav", SEFFECT_RADAROFF); ! LoadWavDataFromFile("torpedo_launch.wav", SEFFECT_TORPEDOLAUNCH); ! LoadWavDataFromFile("shishding.wav", SEFFECT_SONARDETECT); ! if((alGetError())!=AL_NO_ERROR) ! { ! fprintf(stderr, "Error loading wav files.\n"); ! } - for(i=0;i<N_EFFECT_BUFFERS;i++) - { - alGenSources( 1, &SourceEffect[i]); - // alGenBuffers( 1, &BufferEffect[i]); - alSourcei( SourceEffect[i], AL_LOOPING, AL_FALSE); - // alSourcefv( SourceEffect[i], AL_POSITION, position ); - // alSourcefv( SourceEffect[i], AL_VELOCITY, zeroes ); - // alSourcefv( SourceEffect[i], AL_ORIENTATION, back ); - // alSourcef( SourceEffect[i], AL_PITCH, 1.0f ); ! if((alGetError())!=AL_NO_ERROR) ! { ! printf("error creating source %i\n",i); - } - } oggStreamer->Init(); SetMusicVolume(0.5f); --- 46,139 ---- ! /** ! * Based on osgAL example osgal.cpp from ! * http://www.vrlab.umu.se/research/osgAL/osgal.cpp ! */ ! osg::ref_ptr<osgAL::SoundNode> tcSound::CreateSound(const std::string& file) { ! // Create a sample, load a .wav file. ! openalpp::Sample *sample = osgAL::SoundManager::instance()->getSample(file.c_str()); + // Create a named sound state. + std::string stateName = "state_"; + stateName += file; + osgAL::SoundState* sound_state = new osgAL::SoundState(stateName); ! // Let the soundstate use the sample we just created ! sound_state->setSample(sample); ! // Set its gain (volume) to 0.9 ! sound_state->setGain(0.4f); ! // Set its pitch to 1 (normal speed) ! sound_state->setPitch(1); ! // Make it play ! sound_state->setPlay(true); ! // The sound should loop over and over again ! sound_state->setLooping(true); ! // Allocate a hardware soundsource to this soundstate (priority 10) ! // ! sound_state->allocateSource(10, false); + // At 40 the gain will be half of full! + sound_state->setReferenceDistance(10); + sound_state->apply(); ! // Add the soundstate to the sound manager, so we can find it later on if we want to ! osgAL::SoundManager::instance()->addSoundState(sound_state); ! // Create a sound node and attach the soundstate to it. ! osg::ref_ptr<osgAL::SoundNode> sound = new osgAL::SoundNode; ! sound->setSoundState(sound_state); + return sound; + } ! bool tcSound::GetMusicPause() const ! { ! wxASSERT(oggStreamer); ! return oggStreamer->GetPause(); ! } ! ! ! bool tcSound::Init() ! { ! ! InitOsgAL(); ! ! effectMap["Explosion"] = osgAL::SoundManager::instance()->getSample("Explosion.wav"); ! effectMap["Implosion"] = osgAL::SoundManager::instance()->getSample("Implosion.wav"); ! effectMap["ShortBeep"] = osgAL::SoundManager::instance()->getSample("ShortBeep.wav"); ! effectMap["MissileLaunch"] = osgAL::SoundManager::instance()->getSample("MissileLaunch.wav"); ! effectMap["TwoBeeps"] = osgAL::SoundManager::instance()->getSample("TwoBeeps.wav"); ! effectMap["consolebeep"] = osgAL::SoundManager::instance()->getSample("consolebeep.wav"); ! effectMap["Beep2"] = osgAL::SoundManager::instance()->getSample("Beep2.wav"); ! effectMap["RejectBeep"] = osgAL::SoundManager::instance()->getSample("RejectBeep.wav"); ! effectMap["Ping"] = osgAL::SoundManager::instance()->getSample("Ping.wav"); ! effectMap["Ping"] = osgAL::SoundManager::instance()->getSample("Ping.wav"); ! effectMap["Ping2"] = osgAL::SoundManager::instance()->getSample("Ping2.wav"); ! effectMap["radarping"] = osgAL::SoundManager::instance()->getSample("radarping.wav"); ! effectMap["LowBeep"] = osgAL::SoundManager::instance()->getSample("LowBeep.wav"); ! effectMap["Bloop"] = osgAL::SoundManager::instance()->getSample("Bloop.wav"); ! effectMap["NoisyBeepLow"] = osgAL::SoundManager::instance()->getSample("NoisyBeepLow.wav"); ! effectMap["Thuck"] = osgAL::SoundManager::instance()->getSample("Thuck.wav"); ! effectMap["Explosion2"] = osgAL::SoundManager::instance()->getSample("Explosion2.wav"); ! effectMap["Welcome"] = osgAL::SoundManager::instance()->getSample("Welcome.wav"); ! effectMap["jetlaunch"] = osgAL::SoundManager::instance()->getSample("jetlaunch.wav"); ! effectMap["MutedBeep"] = osgAL::SoundManager::instance()->getSample("MutedBeep.wav"); ! effectMap["intercom"] = osgAL::SoundManager::instance()->getSample("intercom.wav"); ! effectMap["fslide"] = osgAL::SoundManager::instance()->getSample("fslide.wav"); ! effectMap["NavalGun1"] = osgAL::SoundManager::instance()->getSample("NavalGun1.wav"); ! effectMap["helolaunch"] = osgAL::SoundManager::instance()->getSample("helolaunch.wav"); ! effectMap["radar_on"] = osgAL::SoundManager::instance()->getSample("radar_on.wav"); ! effectMap["radar_off"] = osgAL::SoundManager::instance()->getSample("radar_off.wav"); ! effectMap["torpedo_launch"] = osgAL::SoundManager::instance()->getSample("torpedo_launch.wav"); ! effectMap["shishding"] = osgAL::SoundManager::instance()->getSample("shishding.wav"); ! oggStreamer->Init(); SetMusicVolume(0.5f); *************** *** 144,224 **** } ! bool tcSound::LoadWavDataFromFile(char *azFileName, unsigned anEffectID) { ! ALboolean err; ! ALsizei size; ! ALsizei freq; ! ALenum format; ! ALvoid *wave; ! ALboolean loop; ! char zFilePath[256]; ! if (anEffectID >= N_SEFFECT) {return false;} // error, out of range ! strcpy(zFilePath,WAV_PATH); // prepend WAV_PATH ! strcat(zFilePath,azFileName); ! alutLoadWAVFile((ALbyte*)zFilePath,&format,&wave,&size,&freq,&loop); ! if (wave == NULL) ! { ! fprintf(stderr,"File not found, wav file %s\n",azFileName); ! return false; ! } ! if((err=alGetError())!=AL_NO_ERROR) { ! fprintf(stderr,"Error loading wav file %s\n",azFileName); ! return false; } - alBufferData( BufferEffect[anEffectID], format, wave, size ,freq ); - alutUnloadWAV(format,wave,size,freq); ! if((err=alGetError())!=AL_NO_ERROR) { ! fprintf(stderr,"Error buffering wav file %s\n",azFileName); ! return false; ! } ! // add to effect map to lookup by name ! wxString fileName(azFileName); ! wxString nameRoot = fileName.BeforeFirst('.'); ! effectMap[std::string(nameRoot.c_str())] = anEffectID; ! return true; ! } ! void tcSound::FillBufferFromFile(char *azFileName,ALuint* buffer) ! { ! ALboolean err; ! ALsizei size; ! ALsizei freq; ! ALenum format; ! ALvoid *wave; ! ALboolean loop; ! char zFilePath[256]; - strcpy(zFilePath,WAV_PATH); // prepend WAV_PATH - strcat(zFilePath,azFileName); - alutLoadWAVFile((ALbyte*)zFilePath,&format,&wave,&size,&freq,&loop); - if((err=alGetError())!=AL_NO_ERROR) - { - fprintf(stderr,"Error loading wav file %s\n",azFileName); - return; - } - alBufferData( *buffer, format, wave, size ,freq ); - alutUnloadWAV(format,wave,size,freq); - } void tcSound::Test() { ! // int nTestEffect = SEFFECT_SHORTBEEP; ! /* int nTestEffect = SEFFECT_REJECTBEEP; if (!mbInitialized) return; PlayEffect(nTestEffect); --- 143,229 ---- } + /** + * @return osgAL::SoundRoot to add to scene graph + */ + osgAL::SoundRoot* tcSound::GetSoundRoot() + { + wxASSERT(soundRoot.valid()); + + return soundRoot.get(); + } ! /** ! * Initialization associated with osgAL. Should be called once at ! * startup. ! */ ! void tcSound::InitOsgAL() { ! osgAL::SoundManager::instance()->init(16); ! osgAL::SoundManager::instance()->getEnvironment()->setDistanceModel(openalpp::InverseDistance); ! osgAL::SoundManager::instance()->getEnvironment()->setDopplerFactor(1); ! osgAL::SoundManager::instance()->addFilePath("sound\\wav"); ! // Create ONE (only one, otherwise the transformation of the listener and update for SoundManager will be ! // called several times, which is not catastrophic, but unnecessary) ! // SoundRoot that will make sure the listener is updated and ! // to keep the internal state of the SoundManager updated ! // This could also be done manually, this is just a handy way of doing it. ! if (!soundRoot.valid()) { ! soundRoot = new osgAL::SoundRoot; } ! // create SoundState's to use as buffers ! for (size_t n=0; n<N_EFFECT_BUFFERS; n++) { ! wxString stateName = wxString::Format("state%d", n); ! osgAL::SoundState* soundState = new osgAL::SoundState(stateName.c_str()); ! soundState->setAmbient(true); ! soundState->setGain(0.5f); // Set its gain (volume) ! soundState->setPitch(1); // Set its pitch to 1 (normal speed) ! soundState->setRelative(true); ! soundState->setPosition(osg::Vec3(0,0,0)); ! soundState->setLooping(false); ! soundState->setStopMethod(openalpp::Stopped); + // Allocate a hardware soundsource to this soundstate (priority 10) + // soundState->allocateSource(10, false); + // Add the soundstate to the sound manager, so we can find it later on if we want to + osgAL::SoundManager::instance()->addSoundState(soundState); ! effectBuffer.push_back(soundState); ! available.push_back(n); ! } ! } ! /** ! * ! */ ! void tcSound::SetListenerDirection(const osg::Vec3& dir) ! { ! osgAL::SoundManager::instance()->setListenerDirection(dir); ! } ! /** ! * Set the transformation matrix for the listener ! */ ! void tcSound::SetListenerMatrix(const osg::Matrix& matrix) ! { ! osgAL::SoundManager::instance()->setListenerMatrix(matrix); ! } void tcSound::Test() { ! // int nTestEffect = "ShortBeep"; ! /* int nTestEffect = "RejectBeep"; if (!mbInitialized) return; PlayEffect(nTestEffect); *************** *** 407,425 **** ! void tcSound::ReleaseStoppedBuffers() { ! ! ALint play; ! for(int i=0;i<N_EFFECT_BUFFERS;i++) { ! if (AL_TRUE==alIsSource(SourceEffect[i])) { ! alGetSourcei(SourceEffect[i],AL_SOURCE_STATE,&play); ! //printf(" buffer %d: %d\n",i,play==AL_PLAYING); ! if (play!=AL_PLAYING) ! { ! ReleaseEffectBuffer(i); ! } } } --- 412,425 ---- ! /** ! * ! */ void tcSound::ReleaseStoppedBuffers() { ! for(size_t i=0; i<effectBuffer.size(); i++) { ! if (!effectBuffer[i]->isPlaying()) { ! ReleaseEffectBuffer(i); } } *************** *** 427,446 **** ! // returns -1 if none available int tcSound::GetEffectBuffer() { ! if (msEffectBufferInfo.mnAvailable <= 0) {ReleaseStoppedBuffers();} ! if (msEffectBufferInfo.mnAvailable <= 0) {return -1;} ! return msEffectBufferInfo.maAvailableBuffers[--msEffectBufferInfo.mnAvailable]; } ! void tcSound::ReleaseEffectBuffer(int anBuffer) { ! if ((anBuffer < 0)||(anBuffer >= N_EFFECT_BUFFERS)) {return;} // error, out of range ! if (msEffectBufferInfo.mnAvailable >= N_EFFECT_BUFFERS) {return;} // error, already full ! msEffectBufferInfo.maAvailableBuffers[msEffectBufferInfo.mnAvailable++] = anBuffer; ! alSourceStop(SourceEffect[anBuffer]); } --- 427,458 ---- ! /** ! * @returns -1 if none available, otherwise returns index to use ! */ int tcSound::GetEffectBuffer() { ! if (available.size() < 4) ! { ! ReleaseStoppedBuffers(); ! } ! ! if (available.size() == 0) {return -1;} ! ! // take index from front of queue ! size_t idx = (size_t)available.front(); ! available.pop_front(); ! ! return idx; } ! void tcSound::ReleaseEffectBuffer(int bufferIdx) { ! if ((bufferIdx < 0)||(bufferIdx >= (int)effectBuffer.size())) {return;} // error, out of range + wxASSERT(effectBuffer[bufferIdx].valid()); + effectBuffer[bufferIdx]->setPlay(false); + if (effectBuffer[bufferIdx]->getSource()) effectBuffer[bufferIdx]->releaseSource(); + available.push_back((size_t)bufferIdx); } *************** *** 448,479 **** void tcSound::PlayEffect(std::string effectName) { ! std::map<std::string, int>::const_iterator mapIter; mapIter = effectMap.find(effectName); if (mapIter == effectMap.end()) { ! std::cerr << "Error - tcSound::PlayEffect - effectName not found in map." ! << std::endl; return; } ! int effectIdx = effectMap[effectName]; ! PlayEffect(effectIdx); ! } - void tcSound::PlayEffect(int anEffect) - { - if (!mbInitialized) return; - if ((anEffect<0)||(anEffect>=N_SEFFECT)) return; // out of range int nFreeBufferIdx = GetEffectBuffer(); // returns -1 if none available ! if ((nFreeBufferIdx < 0)||(nFreeBufferIdx >= N_EFFECT_BUFFERS)) { return; } ! alSourcei( SourceEffect[nFreeBufferIdx], AL_BUFFER, BufferEffect[anEffect] ); - alSourcePlay(SourceEffect[nFreeBufferIdx] ); } --- 460,501 ---- void tcSound::PlayEffect(std::string effectName) { ! if (!mbInitialized) return; ! ! ReleaseStoppedBuffers(); ! ! std::map<std::string, openalpp::Sample*>::const_iterator mapIter; mapIter = effectMap.find(effectName); if (mapIter == effectMap.end()) { ! fprintf(stderr, "Error - tcSound::PlayEffect - effectName (%s) not found in map.\n", ! effectName.c_str()); return; } ! openalpp::Sample* sample = mapIter->second; int nFreeBufferIdx = GetEffectBuffer(); // returns -1 if none available ! if ((nFreeBufferIdx < 0)||(nFreeBufferIdx >= (int)effectBuffer.size())) { return; } + osgAL::SoundState* soundState = effectBuffer[nFreeBufferIdx].get(); + soundState->setSample(sample); + if (!soundState->getSource()) + { + soundState->allocateSource(10, false); + } + soundState->setPlay(true); + } ! /** ! * DEPRECATED ! */ ! void tcSound::PlayEffect(int anEffect) ! { ! wxASSERT(false); } *************** *** 483,504 **** void tcSound::UnInit() { - int i; - if (!mbInitialized) return; ! oggStreamer->Release(); ! for(i=0;i<N_EFFECT_BUFFERS;i++) ! { ! alSourceStop(SourceEffect[i]); ! alDeleteSources(1,&SourceEffect[i]); ! } ! for(i=0;i<N_SEFFECT;i++) ! { ! alDeleteBuffers(1,&BufferEffect[i]); } - alutExit(); mbInitialized = false; --- 505,527 ---- void tcSound::UnInit() { if (!mbInitialized) return; ! effectBuffer.clear(); ! std::map<std::string, openalpp::Sample*>::iterator iter; ! /** mem leak? ! for (iter = effectMap.begin(); iter != effectMap.end(); ++iter) ! { ! delete iter->second; } + */ + + effectMap.clear(); + + oggStreamer->Release(); + + osgAL::SoundManager::instance()->shutdown(); mbInitialized = false; *************** *** 517,529 **** tcSound::tcSound() { - int i; mbInitialized = false; ! for(i=0;i<N_EFFECT_BUFFERS;i++) ! { ! BufferEffect[i] = 0; ! SourceEffect[i] = 0; ! msEffectBufferInfo.maAvailableBuffers[i] = i; ! } ! msEffectBufferInfo.mnAvailable = N_EFFECT_BUFFERS; // all available at start mnCurrentTrack = -1; --- 540,545 ---- tcSound::tcSound() { mbInitialized = false; ! mnCurrentTrack = -1; |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:27
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058/include/scriptinterface Modified Files: tcScenarioInterface.h Log Message: Multiple smoke trail fixes Animation tweaks Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcScenarioInterface.h 5 Dec 2004 02:49:46 -0000 1.12 --- tcScenarioInterface.h 27 Jan 2005 01:01:45 -0000 1.13 *************** *** 118,122 **** void PauseAudio(); void PlayAudio(std::string audioName, double seekTime); ! void PlayEffect(int effectNumber); ///< may want to use string for this instead void SeekAudio(double seekTime); --- 118,122 ---- void PauseAudio(); void PlayAudio(std::string audioName, double seekTime); ! void PlayEffect(const std::string& effectName); ///< may want to use string for this instead void SeekAudio(double seekTime); |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:25
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058 Modified Files: GCblue.vcproj Log Message: Multiple smoke trail fixes Animation tweaks Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** GCblue.vcproj 28 Dec 2004 00:43:07 -0000 1.79 --- GCblue.vcproj 27 Jan 2005 01:01:36 -0000 1.80 *************** *** 39,43 **** Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32d.lib ALutd.lib comctl32.lib rpcrt4.lib wsock32.lib wxmswd.lib zlibd.lib pngd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgParticled.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib sqlite.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" --- 39,43 ---- Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib Gdiplus.lib GLaux.lib wrap_oald.lib ALutd.lib comctl32.lib rpcrt4.lib wsock32.lib wxmswd.lib zlibd.lib pngd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgParticled.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib sqlite.lib osgALd.lib oalppd.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" *************** *** 105,109 **** <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib sqlite.lib OpenThreadsWin32.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" --- 105,109 ---- <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib wrap_oal.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib sqlite.lib OpenThreadsWin32.lib osgAL.lib oalpp.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" *************** *** 357,360 **** --- 357,363 ---- </File> <File + RelativePath=".\src\graphics\tcSmoker.cpp"> + </File> + <File RelativePath=".\src\graphics\tcStartView.cpp"> </File> *************** *** 1269,1272 **** --- 1272,1278 ---- </File> <File + RelativePath=".\include\graphics\tcSmoker.h"> + </File> + <File RelativePath=".\include\graphics\tcStartView.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2005-01-27 01:02:25
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11058/include/common Modified Files: tcSound.h tcSoundConsole.h Log Message: Multiple smoke trail fixes Animation tweaks Index: tcSoundConsole.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcSoundConsole.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcSoundConsole.h 2 Nov 2004 04:23:54 -0000 1.11 --- tcSoundConsole.h 27 Jan 2005 01:01:43 -0000 1.12 *************** *** 42,46 **** void SetDelayedTextEffect(bool effectOn); ! void SetEffect(int anEffect) {mnSoundEffect=anEffect;} void SetLineSpacing(int anSpacing); void SetWrap(int n); --- 42,46 ---- void SetDelayedTextEffect(bool effectOn); ! void SetEffect(const std::string& effect) {soundEffect = effect;} void SetLineSpacing(int anSpacing); void SetWrap(int n); *************** *** 53,57 **** private: tcConsoleBox* textBox; ! int mnSoundEffect; ///< sound effect to use when printing text unsigned int lastEffect; ///< counter value when last sound effect was played }; --- 53,57 ---- private: tcConsoleBox* textBox; ! std::string soundEffect; ///< sound effect to use when printing text unsigned int lastEffect; ///< counter value when last sound effect was played }; Index: tcSound.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcSound.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcSound.h 16 Jan 2005 18:35:56 -0000 1.17 --- tcSound.h 27 Jan 2005 01:01:43 -0000 1.18 *************** *** 45,80 **** #define OGG_PATH "sound\\ogg\\" - #define SEFFECT_EXPLOSION 0 - #define SEFFECT_SHORTBEEP 1 - #define SEFFECT_IMPLOSION 2 - #define SEFFECT_MISSILELAUNCH 3 - #define SEFFECT_TWOBEEPS 4 - #define SEFFECT_CONSOLE 5 - #define SEFFECT_BEEP2 6 - #define SEFFECT_REJECTBEEP 7 - #define SEFFECT_LIGHTSABER 8 - #define SEFFECT_PING 9 - #define SEFFECT_PING2 10 - #define SEFFECT_PING3 11 - #define SEFFECT_LOWBEEP 12 - #define SEFFECT_BLOOP 13 - #define SEFFECT_NOISYBEEP 14 - #define SEFFECT_THUCK 15 - #define SEFFECT_EXPLOSION2 16 - #define SEFFECT_WELCOME 17 - #define SEFFECT_JETLAUNCH 18 - #define SEFFECT_MUTEDBEEP 19 - #define SEFFECT_INTERCOM 20 - #define SEFFECT_FSLIDE 21 - #define SEFFECT_NAVALGUN 22 - #define SEFFECT_HELOLAUNCH 23 - #define SEFFECT_RADARON 24 - #define SEFFECT_RADAROFF 25 - #define SEFFECT_TORPEDOLAUNCH 26 - #define SEFFECT_SONARDETECT 27 ! #define N_SEFFECT 28 ! ! #define N_EFFECT_BUFFERS 16 --- 45,50 ---- #define OGG_PATH "sound\\ogg\\" ! #define N_EFFECT_BUFFERS 32 *************** *** 96,99 **** --- 66,72 ---- static tcSound* Get(); + /// for 3D sound + osg::ref_ptr<osgAL::SoundNode> CreateSound(const std::string& file); + bool GetMusicPause() const; void PlayEffect(int anEffect); *************** *** 107,117 **** void SetMusicVolume(float vol); void StopMusic(int anTrack); ! void StopMusic(void); ! void PlayRandomMusic(void); void UpdateAutoMusic(double afStatusTime); ! void Test(void); ! bool Init(void); ! void UnInit(void); private: --- 80,98 ---- void SetMusicVolume(float vol); void StopMusic(int anTrack); ! void StopMusic(); ! void PlayRandomMusic(); void UpdateAutoMusic(double afStatusTime); ! void Test(); ! bool Init(); ! void UnInit(); ! ! // 3D sound methods ! osgAL::SoundRoot* GetSoundRoot(); ! void InitOsgAL(); ! void SetListenerDirection(const osg::Vec3& dir); ! ! /// Set the transformation matrix for the listener ! void SetListenerMatrix(const osg::Matrix& matrix); private: *************** *** 120,131 **** ~tcSound(); ! std::map<std::string, int> effectMap; tcOggStreamer *oggStreamer; ///< class for streaming Ogg music ! struct _effectbuffinfo ! { ! int maAvailableBuffers[N_EFFECT_BUFFERS]; ! int mnAvailable; ! } msEffectBufferInfo; bool mbInitialized; --- 101,115 ---- ~tcSound(); ! std::map<std::string, openalpp::Sample*> effectMap; ! ! /// buffer of SoundState's to use for non-directional sound effects ! std::vector<osg::ref_ptr<osgAL::SoundState> > effectBuffer; ! ! /// fifo of indices of available effectSounds ! std::deque<size_t> available; tcOggStreamer *oggStreamer; ///< class for streaming Ogg music ! ! bool mbInitialized; *************** *** 136,149 **** long mnEffectVolume; - int effectsrc; ! ALuint SourceEffect[N_EFFECT_BUFFERS]; ///< these are sources TODO change name and make them provate ! ALuint BufferEffect[N_SEFFECT]; ///< these are buffers ! void FillBufferFromFile(char *azFileName,ALuint* buffer); ! bool LoadWavDataFromFile(char *azFileName, unsigned anEffectID); ! int GetEffectBuffer(void); ! void ReleaseEffectBuffer(int); ! void ReleaseStoppedBuffers(void); }; --- 120,130 ---- long mnEffectVolume; ! osg::ref_ptr<osgAL::SoundRoot> soundRoot; ///< for 3D sound with osgAL ! ! int GetEffectBuffer(); ! void ReleaseEffectBuffer(int bufferIdx); ! void ReleaseStoppedBuffers(); }; |
|
From: Dewitt C. <ddc...@us...> - 2005-01-16 18:36:40
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32325/src/graphics Modified Files: ObjectUpdater.cpp tc3DModel.cpp Added Files: tcSmoker.cpp Log Message: Added xml 3D model wrapper for better modularity Improved animation support --- NEW FILE: tcSmoker.cpp --- /** ** @file tcSmoker.cpp */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" // precompiled header file #ifndef WX_PRECOMP #include "wx/wx.h" #endif // WX_PRECOMP #include "tcSmoker.h" #include "tcGameObject.h" #include "tcParticleEffect.h" #include "tcParticlePlacer.h" #ifdef _DEBUG #define new DEBUG_NEW #endif osg::ref_ptr<osg::Group> tcSmoker::world; /** * Static method to set common world frame to all tcSmoker objects */ void tcSmoker::SetWorldFrame(osg::Group* worldFrame) { world = worldFrame; } /** * */ void tcSmoker::AddSmokeTrail(const osg::Vec3& smokeSource, int smokeMode) { tcSmokeTrail trail; trail.smokeEffect = new tcParticleEffect(smokeMode); trail.smokeEffect->AddToSceneGraph(world.get()); trail.smokePlacer = trail.smokeEffect->GetParticlePlacer(); trail.smokeSource = smokeSource; smokeTrails.push_back(trail); } /** * */ void tcSmoker::DeleteTrails() { size_t nSmoke = smokeTrails.size(); for (size_t n=0; n<nSmoke; n++) { tcSmokeTrail& trail = smokeTrails[n]; trail.smokeEffect->DetachFromSceneGraph(); delete trail.smokeEffect; } smokeTrails.clear(); } /** * */ bool tcSmoker::IsEnabled() const { return smokeTrails.size() != 0; } /** * */ void tcSmoker::SetGameObject(tcGameObject* obj) { gameObj = obj; } /** * */ void tcSmoker::UpdateSmokePosition(float x, float y, float z) { wxASSERT(gameObj); // create rotation matrix (using euler angles for now) const osg::Vec3 xaxis(-1, 0, 0); const osg::Vec3 yaxis(0, 1, 0); const osg::Vec3 zaxis(0, 0, 1); osg::Vec3 pos(x, y, z); // heading, pitch, roll osg::Matrixf rotation; rotation.makeRotate(gameObj->mcKin.mfHeading_rad, zaxis, gameObj->mcKin.mfPitch_rad, xaxis, gameObj->mcKin.mfRoll_rad, yaxis); size_t nSmoke = smokeTrails.size(); for (size_t n=0; n<nSmoke; n++) { tcSmokeTrail& trail = smokeTrails[n]; wxASSERT(trail.smokePlacer); if (trail.smokePlacer == 0) return; osg::Vec3 smokeOffset = rotation * trail.smokeSource; osg::Vec3 offsetPos = pos + smokeOffset; trail.smokePlacer->setCenter(offsetPos.x(), offsetPos.y(), offsetPos.z()); } } /** * */ tcSmoker::tcSmoker() : gameObj(0) { } /** * */ tcSmoker::~tcSmoker() { } Index: ObjectUpdater.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/ObjectUpdater.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ObjectUpdater.cpp 6 Nov 2004 15:13:41 -0000 1.11 --- ObjectUpdater.cpp 16 Jan 2005 18:36:29 -0000 1.12 *************** *** 68,71 **** --- 68,74 ---- if (nAnimations == 0) return; + tcGameObject* gameObject = model->GetGameObj(); + wxASSERT(gameObject); + // do not update animations if camera is beyond animation LOD distance //if (distanceFromCamera > 10000.0f) return; *************** *** 75,83 **** tcAnimationInfo& info = model->animationInfo[n]; int isActive = (info.switchVariable) ? *info.switchVariable : true; ! if (isActive) { osg::MatrixTransform *xform = info.transform; osg::Matrix matrix = xform->getMatrix(); double angle = info.omega * viewer->GetGameTime(); xform->setMatrix(matrix.rotate(angle , info.axis)); } --- 78,93 ---- tcAnimationInfo& info = model->animationInfo[n]; int isActive = (info.switchVariable) ? *info.switchVariable : true; ! if (info.bound && isActive) { osg::MatrixTransform *xform = info.transform; osg::Matrix matrix = xform->getMatrix(); double angle = info.omega * viewer->GetGameTime(); + + // scale rotation rate by platform speed for propeller animation type + if (info.animationType == 0) + { + angle *= gameObject->mcKin.mfSpeed_kts; + } + xform->setMatrix(matrix.rotate(angle , info.axis)); } *************** *** 140,144 **** - float yawCorrection = C_PI; // 180 degrees added to yaw for different 3D model convention --- 150,153 ---- *************** *** 156,161 **** osg::Matrix m = osg::Matrix::rotate(osg::inRadians(roll),0.0f,1.0f,0.0f)* ! osg::Matrix::rotate(-osg::inRadians(pitch),1.0f,0.0f,0.0f)* ! osg::Matrix::rotate(-osg::inRadians(yaw + yawCorrection),0.0f,0.0f,1.0f)*osg::Matrix::translate(x,y,z) ; --- 165,170 ---- osg::Matrix m = osg::Matrix::rotate(osg::inRadians(roll),0.0f,1.0f,0.0f)* ! osg::Matrix::rotate(osg::inRadians(pitch),1.0f,0.0f,0.0f)* ! osg::Matrix::rotate(-osg::inRadians(yaw),0.0f,0.0f,1.0f)*osg::Matrix::translate(x,y,z) ; *************** *** 172,176 **** float x, y, z; bool isVisible = true; - float yawCorrection = 0; tcGameObject* gameObject = model->GetGameObj(); --- 181,184 ---- *************** *** 188,192 **** z = kin->mfAlt_m; ! yawCorrection = C_PI; // 180 degrees added to yaw for different 3D model convention } else --- 196,200 ---- z = kin->mfAlt_m; ! } else *************** *** 196,201 **** pitch = pos->pitch; roll = pos->roll; ! x = -pos->dx; // backwards because of 180 deg model issue ! y = pos->dz; // backwards because of 180 deg model issue z = pos->dy; isVisible = pos->isVisible; --- 204,209 ---- pitch = pos->pitch; roll = pos->roll; ! x = pos->dx; ! y = -pos->dz; z = pos->dy; isVisible = pos->isVisible; *************** *** 215,220 **** osg::Matrix m = osg::Matrix::rotate(osg::inRadians(roll),0.0f,1.0f,0.0f)* ! osg::Matrix::rotate(-osg::inRadians(pitch),1.0f,0.0f,0.0f)* ! osg::Matrix::rotate(-osg::inRadians(yaw + yawCorrection),0.0f,0.0f,1.0f)*osg::Matrix::translate(x,y,z) ; if (isVisible) --- 223,228 ---- osg::Matrix m = osg::Matrix::rotate(osg::inRadians(roll),0.0f,1.0f,0.0f)* ! osg::Matrix::rotate(osg::inRadians(pitch),1.0f,0.0f,0.0f)* ! osg::Matrix::rotate(-osg::inRadians(yaw),0.0f,0.0f,1.0f)*osg::Matrix::translate(x,y,z) ; if (isVisible) Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tc3DModel.cpp 10 Jan 2005 00:30:54 -0000 1.19 --- tc3DModel.cpp 16 Jan 2005 18:36:29 -0000 1.20 *************** *** 34,37 **** --- 34,38 ---- #include "tcParticlePlacer.h" #include "tcGenericDBObject.h" + #include "common/tinyxml.h" #include <osg/MatrixTransform> #include <osg/Switch> *************** *** 57,65 **** osg::ref_ptr<osg::Node> m_Root; std::vector<tcAnimationInfo>& animationInfo; // vector of animation state info to update ! std::vector<animationDBInfo>& databaseInfo; ///< database info to find and configure animations public: ! AnimationProcessor(std::vector<tcAnimationInfo>& ai, std::vector<animationDBInfo>& adb) : NodeVisitor(TRAVERSE_ALL_CHILDREN) ! , animationInfo(ai), databaseInfo(adb) { } --- 58,66 ---- osg::ref_ptr<osg::Node> m_Root; std::vector<tcAnimationInfo>& animationInfo; // vector of animation state info to update ! public: ! AnimationProcessor(std::vector<tcAnimationInfo>& ai) : NodeVisitor(TRAVERSE_ALL_CHILDREN) ! , animationInfo(ai) { } *************** *** 80,91 **** } */ ! // search database for entry matching this node bool animateNode = false; ! animationDBInfo info; ! size_t nAnimations = databaseInfo.size(); ! for(size_t n=0;(n<nAnimations)&&(!animateNode);n++) { ! info = databaseInfo[n]; ! if (info.objectName == name) animateNode = true; } --- 81,93 ---- } */ ! ! // search for entry matching this node bool animateNode = false; ! tcAnimationInfo* info = 0; ! size_t nAnimations = animationInfo.size(); ! for(size_t n=0; (n<nAnimations)&&(!animateNode); n++) { ! info = &animationInfo[n]; ! if (info->objectName == name) animateNode = true; } *************** *** 116,143 **** ! tcAnimationInfo ai; ! if (info.animationType == "propeller") ! { ! ai.axis = osg::Vec3(0,1.0f,0); ! ai.animationType = 0; ! ai.omega = 10.0f; ! } ! else if (info.animationType == "rotor") ! { ! ai.axis = osg::Vec3(0,0,1.0f); ! ai.animationType = 2; ! ai.omega = 10.0f; ! } ! else ! { ! ai.axis = osg::Vec3(0,0,1.0f); ! ai.animationType = 1; ! ai.omega = 0.2f; ! ai.param = info.param; ! } ! ai.switchVariable = NULL; ! ai.transform = rotateTransform; - animationInfo.push_back(ai); if (tcOptions::Get()->OptionStringExists("Log3DModelDetails")) { --- 118,125 ---- ! info->switchVariable = NULL; ! info->transform = rotateTransform; ! info->bound = true; if (tcOptions::Get()->OptionStringExists("Log3DModelDetails")) { *************** *** 263,266 **** --- 245,257 ---- bool tc3DModel::useSmoothing = true; + /** + * Static method to set common world frame to all tc3DModel objects + */ + void tc3DModel::SetWorldFrame(osg::Group* worldFrame) + { + world = worldFrame; + tcSmoker::SetWorldFrame(worldFrame); + } + /** * Static method to load unknowns models. Should be called *************** *** 326,334 **** void tc3DModel::DisableSmoke() { ! if (smokeTrail) { ! smokeTrail->DetachFromSceneGraph(); ! smokeTrail = 0; ! smokePlacer = 0; } } --- 317,323 ---- void tc3DModel::DisableSmoke() { ! if (smokeTrails.IsEnabled()) { ! smokeTrails.DeleteTrails(); } } *************** *** 340,355 **** void tc3DModel::EnableSmoke() { ! smokeTrail = new tcParticleEffect(smokeMode); ! smokeTrail->AddToSceneGraph(world.get()); ! smokePlacer = smokeTrail->GetParticlePlacer(); ! ! if (smokeMode == tcParticleEffect::BUBBLES) ! { ! smokeSource.set(0, -GetRadius(), 0); ! } ! else { ! smokeSource.set(0, 0, 0); } } --- 329,346 ---- void tc3DModel::EnableSmoke() { ! switch (smokeMode) { ! case tcParticleEffect::AFTERBURNER: ! case tcParticleEffect::BUBBLES: ! for (size_t n=0; n<engineSmokeSources.size(); n++) ! { ! smokeTrails.AddSmokeTrail(engineSmokeSources[n], smokeMode); ! } ! break; ! default: ! smokeTrails.AddSmokeTrail(osg::Vec3(0, 0, 0), smokeMode); ! break; } + } *************** *** 397,400 **** --- 388,402 ---- } + /** + * @return true if smokeTrails object is active + */ + bool tc3DModel::IsSmokeEnabled() const + { + return smokeTrails.IsEnabled(); + } + + /** + * @param model_name model file name with extension + */ void tc3DModel::Load(std::string model_name) { *************** *** 405,423 **** } ! // try ive load first ! std::string full_name = model_name + ".ive"; ! ! modelNode = osgDB::readNodeFile(full_name.c_str()); if (!modelNode.valid()) { ! full_name = model_name + ".3ds"; ! modelNode = osgDB::readNodeFile(full_name.c_str()); ! if (!modelNode.valid()) ! { ! std::cout << "Load of 3D model: " << model_name << " failed.\n"; ! std::cerr << "Load of 3D model: " << model_name << " failed.\n"; ! return; ! } } if (useSmoothing) { --- 407,417 ---- } ! modelNode = osgDB::readNodeFile(model_name.c_str()); if (!modelNode.valid()) { ! std::cout << "Load of 3D model: " << model_name << " failed.\n"; ! std::cerr << "Load of 3D model: " << model_name << " failed.\n"; } + if (useSmoothing) { *************** *** 426,436 **** } ! fprintf(stdout,"tc3DModel--Loaded 3D model: %s\n", full_name.c_str()); } ! void tc3DModel::ProcessAnimations(std::vector<animationDBInfo>& animDBInfo) { ! AnimationProcessor animationProcessor(animationInfo, animDBInfo); modelNode->accept(animationProcessor); } --- 420,572 ---- } ! fprintf(stdout, "tc3DModel--Loaded 3D model: %s\n", model_name.c_str()); } ! /** ! * Newer 3D model system. Loads from an Xml file which has ! * animation info along with model file name and other info. ! * This can also be used to support multiple resolution and damage ! * models in the future. ! */ ! void tc3DModel::LoadXml(const std::string& file_name) { ! std::string fileNameWithPath = "3d\\"; ! fileNameWithPath += file_name; ! ! TiXmlDocument* doc = new TiXmlDocument(fileNameWithPath.c_str()); ! if (!doc->LoadFile()) ! { ! delete doc; ! fprintf(stderr, "Error loading XML file %s\n", file_name.c_str()); ! modelNode = unknownAll.get(); // use unknown model as default ! return; ! } ! ! TiXmlNode* node = doc->FirstChild("Model"); ! ! ! if (!node) ! { ! delete doc; ! fprintf(stderr, "Model entry missing in XML file %s\n", file_name.c_str()); ! modelNode = unknownAll.get(); // use unknown model as default ! return; ! } ! ! TiXmlElement* current = node->ToElement(); ! wxASSERT(current); ! ! std::string modelFileName = current->Attribute("File"); ! ! Load(modelFileName); ! ! LoadXmlAnimationInfo(doc); ! ! LoadXmlSmokeInfo(doc); ! ! ProcessAnimations(); ! ! delete doc; ! } ! ! /** ! * Loads animation info for model (if available) ! * This will populate the animationInfo vector ! */ ! void tc3DModel::LoadXmlAnimationInfo(TiXmlDocument* doc) ! { ! animationInfo.clear(); ! ! TiXmlNode* current = doc->FirstChild("Animation"); ! while (current) ! { ! if (TiXmlElement* elt = current->ToElement()) ! { ! tcAnimationInfo ai; ! double axisx = 0; ! double axisy = 0; ! double axisz = 0; ! double angleRate = 0.1; ! ! ai.bound = false; ! ai.objectName = elt->Attribute("Object"); ! ai.animationTypeName = elt->Attribute("Type"); ! ai.param = 0; ! ai.transform = 0; ! ai.axis.set(1, 0, 0); // default ! ! if (ai.animationTypeName == "Sensor") ! { ! elt->Attribute("SensorIndex", &ai.param); ! ai.animationType = 1; ! } ! else if (ai.animationTypeName == "Propeller") ! { ! ai.animationType = 0; ! } ! else if (ai.animationTypeName == "Rotor") ! { ! ai.animationType = 2; ! } ! else ! { ! fprintf(stderr, "Unrecognized animation type (%s)\n", ai.animationTypeName.c_str()); ! } ! ! // read rotation axis values ! elt->Attribute("AxisX", &axisx); ! elt->Attribute("AxisY", &axisy); ! elt->Attribute("AxisZ", &axisz); ! ! ai.axis.set(axisx, axisy, axisz); ! ai.axis.normalize(); ! ! elt->Attribute("AngleRate", &angleRate); ! ai.omega = angleRate; ! ! animationInfo.push_back(ai); ! ! } ! current = current->NextSibling("Animation"); ! } ! } ! ! ! /** ! * Loads smoke trails location info for model (if available) ! * This will populate the engineSmokeSources vector ! */ ! void tc3DModel::LoadXmlSmokeInfo(TiXmlDocument* doc) ! { ! engineSmokeSources.clear(); ! ! TiXmlNode* current = doc->FirstChild("Smoke"); ! while (current) ! { ! if (TiXmlElement* elt = current->ToElement()) ! { ! double x = 0; ! double y = 0; ! double z = 0; ! ! elt->Attribute("X", &x); ! elt->Attribute("Y", &y); ! elt->Attribute("Z", &z); ! ! engineSmokeSources.push_back(osg::Vec3(x, y, z)); ! } ! ! current = current->NextSibling("Smoke"); ! } ! ! } ! ! /** ! * ! */ ! void tc3DModel::ProcessAnimations() ! { ! AnimationProcessor animationProcessor(animationInfo); modelNode->accept(animationProcessor); } *************** *** 510,518 **** * Bind switchVariable for animations */ ! void tc3DModel::SetupUpdate(tcGameObject *obj) { wxASSERT(modelTransform->getUpdateCallback() == NULL); gameObj = obj; modelTransform->setUpdateCallback(new ObjectUpdater(this)); } --- 646,656 ---- * Bind switchVariable for animations */ ! void tc3DModel::SetupUpdate(tcGameObject* obj) { wxASSERT(modelTransform->getUpdateCallback() == NULL); gameObj = obj; modelTransform->setUpdateCallback(new ObjectUpdater(this)); + + smokeTrails.SetGameObject(obj); } *************** *** 543,566 **** void tc3DModel::UpdateSmokePosition(float x, float y, float z) { ! wxASSERT(smokePlacer); ! if (smokePlacer == 0) return; ! wxASSERT(gameObj); ! ! const osg::Vec3 xaxis(-1, 0, 0); ! const osg::Vec3 yaxis(0, 1, 0); ! const osg::Vec3 zaxis(0, 0, 1); ! ! osg::Vec3 pos(x, y, z); ! ! // heading, pitch, roll ! osg::Matrixf rotation; ! ! rotation.makeRotate(gameObj->mcKin.mfHeading_rad, zaxis, ! gameObj->mcKin.mfPitch_rad, xaxis, ! gameObj->mcKin.mfRoll_rad, yaxis); ! osg::Vec3 smokeOffset = rotation * smokeSource; ! pos = pos + smokeOffset; ! ! smokePlacer->setCenter(pos.x(), pos.y(), pos.z()); } --- 681,685 ---- void tc3DModel::UpdateSmokePosition(float x, float y, float z) { ! smokeTrails.UpdateSmokePosition(x, y, z); } *************** *** 579,584 **** */ tc3DModel::tc3DModel(const tc3DModel* source) ! : smokePlacer(0), smokeTrail(0), ! distanceFromCamera(1e10) { wxASSERT(source->modelNode.valid()); // error if modelNode not loaded yet --- 698,702 ---- */ tc3DModel::tc3DModel(const tc3DModel* source) ! : distanceFromCamera(1e10) { wxASSERT(source->modelNode.valid()); // error if modelNode not loaded yet *************** *** 608,611 **** --- 726,731 ---- } + engineSmokeSources = source->engineSmokeSources; + modelNode = dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,true,0))); |
|
From: Dewitt C. <ddc...@us...> - 2005-01-16 18:36:40
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32325/src/sim Modified Files: Game.cpp Log Message: Added xml 3D model wrapper for better modularity Improved animation support Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** Game.cpp 10 Jan 2005 00:30:54 -0000 1.115 --- Game.cpp 16 Jan 2005 18:36:29 -0000 1.116 *************** *** 569,577 **** meScreenMode = START; - if (tcOptions::Get()->mbPlayMusic) - { - tcSound::Get()->PlayMusic("gcb_theme2"); - } - wxWindow::Show(TRUE); } --- 569,572 ---- *************** *** 1317,1320 **** --- 1312,1316 ---- { static teScreenMode lastMode = NONE; + static bool musicStarted = false; tcTime::Get()->Update(); *************** *** 1432,1436 **** viewer->Frame(); ! tcSound::Get()->UpdateAutoMusic(0); #if 0 --- 1428,1438 ---- viewer->Frame(); ! if (!musicStarted && (tcOptions::Get()->mbPlayMusic)) ! { ! tcSound::Get()->PlayMusic("gcb_theme2"); ! musicStarted = true; ! } ! ! tcSound::Get()->UpdateAutoMusic(0); #if 0 |
|
From: Dewitt C. <ddc...@us...> - 2005-01-16 18:36:39
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32325/src/database Modified Files: tcDatabaseObject.cpp tcGenericDBObject.cpp Log Message: Added xml 3D model wrapper for better modularity Improved animation support Index: tcDatabaseObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabaseObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcDatabaseObject.cpp 30 Dec 2004 17:26:06 -0000 1.14 --- tcDatabaseObject.cpp 16 Jan 2005 18:36:28 -0000 1.15 *************** *** 150,154 **** model = new tc3DModel(); wxASSERT(model); ! model->Load(mz3DModelFileName.mz); } --- 150,154 ---- model = new tc3DModel(); wxASSERT(model); ! model->LoadXml(mz3DModelFileName.mz); } Index: tcGenericDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcGenericDBObject.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcGenericDBObject.cpp 30 Dec 2004 17:26:06 -0000 1.17 --- tcGenericDBObject.cpp 16 Jan 2005 18:36:28 -0000 1.18 *************** *** 46,83 **** { - /** - * Search 3D model for animation nodes. Configure - * animation data for matching nodes. - */ - void tcGenericDBObject::Animate3DModel() - { - //if (animationInfo.size()==0) return; // no animation in this model - if (model) - { - model->ProcessAnimations(animationInfo); - } - } - tc3DModel* tcGenericDBObject::Get3DModel() - { - if (model) - { - return model->Clone(); - } - else - { - Load3DModel(); - Animate3DModel(); - if (model) - { - return model->Clone(); - } - else - { - return NULL; - } - } - } tcFlightportDBObject* tcGenericDBObject::GetFlightport() --- 46,51 ---- *************** *** 249,253 **** file.Read(&maSensorClass[i],sizeof(tcDBString)); } - Animate3DModel(); } else --- 217,220 ---- *************** *** 358,362 **** } } - Animate3DModel(); } else --- 325,328 ---- *************** *** 796,800 **** } } - Animate3DModel(); } --- 762,765 ---- |
|
From: Dewitt C. <ddc...@us...> - 2005-01-16 18:36:07
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32186/include/graphics Modified Files: tc3DModel.h Added Files: tcSmoker.h Log Message: Added xml 3D model wrapper for better modularity Improved animation support Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tc3DModel.h 23 Nov 2004 23:30:33 -0000 1.10 --- tc3DModel.h 16 Jan 2005 18:35:57 -0000 1.11 *************** *** 27,30 **** --- 27,31 ---- #endif + #include "tcSmoker.h" #include <osg/ref_ptr> #include <osg/Group> *************** *** 53,56 **** --- 54,61 ---- { public: + bool bound; ///< true if animation was successfully found in 3D model and associated with sim model + std::string objectName; ///< name of object within model to animate + std::string animationTypeName; ///< "propeller" + osg::Vec3 axis; float omega; ///< radians per second *************** *** 58,65 **** float *controlVariable; osg::MatrixTransform* transform; ///< transform to rotate ! int animationType; ///< 0 - propeller, 1 - sensor mast int param; ///< sensor number }; /** --- 63,71 ---- float *controlVariable; osg::MatrixTransform* transform; ///< transform to rotate ! int animationType; ///< 0 - propeller, 1 - sensor mast, 2 - helo rotor int param; ///< sensor number }; + class TiXmlDocument; /** *************** *** 90,96 **** float GetRadius(); float GetRadiusGeneric(); ! bool IsSmokeEnabled() const {return smokeTrail != 0;} ! void Load(std::string model_name); ! void ProcessAnimations(std::vector<animationDBInfo>& animDBInfo); void SetupAnimation(tcGameObject *obj); void SetDistanceFromCamera(float distance) {distanceFromCamera = distance;} --- 96,103 ---- float GetRadius(); float GetRadiusGeneric(); ! bool IsSmokeEnabled() const; ! ! void LoadXml(const std::string& file_name); ! void SetupAnimation(tcGameObject *obj); void SetDistanceFromCamera(float distance) {distanceFromCamera = distance;} *************** *** 106,116 **** static void LoadUnknowns(); ! static void SetWorldFrame(osg::Group* worldFrame) {world = worldFrame;} private: ! tcParticleEffect* smokeTrail; ! osgParticle::tcParticlePlacer* smokePlacer; ! osg::Vec3 smokeSource; ///< position of smoke emitter in model coordinates int smokeMode; --- 113,125 ---- static void LoadUnknowns(); ! static void SetWorldFrame(osg::Group* worldFrame); private: ! tcSmoker smokeTrails; ! ! ///< position of smoke emitters in model coordinates for afterburner and propeller ! std::vector<osg::Vec3> engineSmokeSources; ! int smokeMode; *************** *** 136,139 **** --- 145,152 ---- void DisableSmoke(); void EnableSmoke(); + void Load(std::string model_name); + void LoadXmlAnimationInfo(TiXmlDocument* doc); + void LoadXmlSmokeInfo(TiXmlDocument* doc); + void ProcessAnimations(); }; --- NEW FILE: tcSmoker.h --- /** ** @file tcSmoker.h */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _TCSMOKER_H_ #define _TCSMOKER_H_ #if _MSC_VER > 1000 #pragma once #endif #include <osg/ref_ptr> #include <osg/Group> #include <osg/LOD> #include <osg/MatrixTransform> class tcGameObject; class tcParticleEffect; namespace osgParticle { class tcParticlePlacer; } class tcGameObject; /** * */ class tcSmokeTrail { public: tcParticleEffect* smokeEffect; osgParticle::tcParticlePlacer* smokePlacer; osg::Vec3 smokeSource; ///< position of smoke emitter in model coordinates }; /** * Collection of smoke trails using particle effects */ class tcSmoker { public: void AddSmokeTrail(const osg::Vec3& smokeSource, int smokeMode); void DeleteTrails(); bool IsEnabled() const; void SetGameObject(tcGameObject* obj); void UpdateSmokePosition(float x, float y, float z); static void SetWorldFrame(osg::Group* worldFrame); tcSmoker(); ~tcSmoker(); private: std::vector<tcSmokeTrail> smokeTrails; tcGameObject *gameObj; ///< game object to use to update model state static osg::ref_ptr<osg::Group> world; }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2005-01-16 18:36:07
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32186/include/common Modified Files: tcSound.h Log Message: Added xml 3D model wrapper for better modularity Improved animation support Index: tcSound.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcSound.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcSound.h 10 Jan 2005 00:30:20 -0000 1.16 --- tcSound.h 16 Jan 2005 18:35:56 -0000 1.17 *************** *** 31,34 **** --- 31,40 ---- #include <AL/alut.h> #include <AL/alc.h> + + #include "osgAL/SoundNode" + #include "osgAL/SoundRoot" + #include "osgAL/SoundManager" + #include "osgAL/SoundState" + #include <string> #include <map> |
|
From: Dewitt C. <ddc...@us...> - 2005-01-16 18:36:07
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32186/include/database Modified Files: tcGenericDBObject.h Log Message: Added xml 3D model wrapper for better modularity Improved animation support Index: tcGenericDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcGenericDBObject.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcGenericDBObject.h 30 Dec 2004 17:26:06 -0000 1.14 --- tcGenericDBObject.h 16 Jan 2005 18:35:56 -0000 1.15 *************** *** 88,93 **** std::vector<animationDBInfo> animationInfo; ! void Animate3DModel(); ! virtual tc3DModel* Get3DModel(); virtual const char* GetClassName() {return "Generic";} ///< returns class name of database object bool IsLeaf() const; ///< returns true if db obj is a leaf obj --- 88,92 ---- std::vector<animationDBInfo> animationInfo; ! virtual const char* GetClassName() {return "Generic";} ///< returns class name of database object bool IsLeaf() const; ///< returns true if db obj is a leaf obj |
|
From: Dewitt C. <ddc...@us...> - 2005-01-10 00:31:13
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27845/src/sim Modified Files: Game.cpp tcCommandQueue.cpp tcObjectControl.cpp tcSimState.cpp tcSonar.cpp Log Message: Fixed group commands Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** tcSimState.cpp 11 Dec 2004 01:09:08 -0000 1.62 --- tcSimState.cpp 10 Jan 2005 00:30:55 -0000 1.63 *************** *** 1452,1456 **** if (mpUserInfo->IsOwnAlliance(launchingPlatform->mnAlliance)) { ! //tcSound::Get()->PlayEffect(SEFFECT_MISSILELAUNCH); } } --- 1452,1456 ---- if (mpUserInfo->IsOwnAlliance(launchingPlatform->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_TORPEDOLAUNCH); } } Index: tcCommandQueue.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCommandQueue.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcCommandQueue.cpp 11 Dec 2004 01:09:08 -0000 1.1 --- tcCommandQueue.cpp 10 Jan 2005 00:30:55 -0000 1.2 *************** *** 69,73 **** newcmd.mbCallback = false; newcmd.mbGetUserInput = false; ! newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { --- 69,73 ---- newcmd.mbCallback = false; newcmd.mbGetUserInput = false; ! newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) { *************** *** 89,93 **** strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); ! newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { --- 89,93 ---- strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); ! newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) { *************** *** 109,113 **** strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); ! newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { --- 109,113 ---- strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); ! newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) { *************** *** 130,134 **** strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); ! newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { --- 130,134 ---- strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); ! newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) { *************** *** 154,158 **** strcpy(newcmd.mzString , azCallback); strcpy(newcmd.mzUserInput, azUserInput); ! newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { --- 154,158 ---- strcpy(newcmd.mzString , azCallback); strcpy(newcmd.mzUserInput, azUserInput); ! newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) { *************** *** 170,174 **** */ void tcCommandQueue::GetUserInputForID(const char *azCallback, const char *azUserInput, ! long platformID, int param) { tsCommandInfo newcmd; --- 170,174 ---- */ void tcCommandQueue::GetUserInputForID(const char *azCallback, const char *azUserInput, ! std::vector<long>& platformID, int param) { tsCommandInfo newcmd; *************** *** 205,209 **** strcpy(newcmd.mzString , azCallback); strcpy(newcmd.mzUserInput, azUserInput); ! newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { --- 205,209 ---- strcpy(newcmd.mzString , azCallback); strcpy(newcmd.mzUserInput, azUserInput); ! newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) { *************** *** 216,220 **** */ void tcCommandQueue::AddPythonCallbackForID(const char *azCallback, const char *azUserInput, ! long platformID, int param) { tsCommandInfo newcmd; --- 216,220 ---- */ void tcCommandQueue::AddPythonCallbackForID(const char *azCallback, const char *azUserInput, ! std::vector<long>& platformID, int param) { tsCommandInfo newcmd; *************** *** 244,248 **** newcmd.mbUsePython = false; strcpy(newcmd.mzString, azString); ! newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { --- 244,248 ---- newcmd.mbUsePython = false; strcpy(newcmd.mzString, azString); ! newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) { Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcObjectControl.cpp 21 Dec 2004 02:26:18 -0000 1.28 --- tcObjectControl.cpp 10 Jan 2005 00:30:55 -0000 1.29 *************** *** 39,42 **** --- 39,43 ---- #include "tcAeroAirObject.h" #include "tcAirDBObject.h" + #include "tcTorpedoDBObject.h" #include "tcTime.h" #include "tcLauncher.h" *************** *** 699,703 **** return; // obj not found } ! teButtonState eLauncherState, eDatumState, eTargetState, eLaunchState; tcLauncherState *pLauncherState; mpHookedGameObj->GetLauncherState(pLauncherState); --- 700,704 ---- return; // obj not found } ! teButtonState eLauncherState; tcLauncherState *pLauncherState; mpHookedGameObj->GetLauncherState(pLauncherState); *************** *** 727,761 **** mcWeaponPanel.mastrCaption[i][1].Format("%d", nLaunchCount); ! switch(pLauncher->meLaunchMode) { ! case AUTO: ! mcWeaponPanel.mastrCaption[i][4].Format("L-%s","AUT"); ! break; ! case DATUM_ONLY: ! mcWeaponPanel.mastrCaption[i][4].Format("L-%s","DAT"); ! break; ! case FC_TRACK: ! mcWeaponPanel.mastrCaption[i][4].Format("L-%s","SA"); ! break; ! case SEEKER_TRACK: ! mcWeaponPanel.mastrCaption[i][4].Format("L-%s","SKR"); ! break; ! default: ! mcWeaponPanel.mastrCaption[i][4].Format("L-%s","ERR"); ! break; } bool bDatumActive = (pLauncher->msDatum.mfLat_rad!=0)&&(pLauncher->msDatum.mfLon_rad!=0); bool bTrackActive = (pLauncher->mnTargetID != NULL_INDEX); bool bReadyForLaunch; bool bLauncherActive = (nLaunchCount > 0) && (!pLauncher->isLoading); ! if (bTrackActive) ! { ! mcWeaponPanel.mastrCaption[i][3].Format("U%d",pLauncher->mnTargetID); ! } ! else ! { ! mcWeaponPanel.mastrCaption[i][3] = "FC"; ! } if (pLauncher->meLaunchMode == AUTO) --- 728,747 ---- mcWeaponPanel.mastrCaption[i][1].Format("%d", nLaunchCount); ! // hack to display "P" only when launcher has associated preset (torpedoes only at the moment) ! mcWeaponPanel.mastrCaption[i][2] = ""; ! if (pLauncher) { ! if (tcTorpedoDBObject* torpDBObj = dynamic_cast<tcTorpedoDBObject*>(pLauncher->mpChildDBObj)) ! { ! mcWeaponPanel.mastrCaption[i][2] = "P"; ! } } + bool bDatumActive = (pLauncher->msDatum.mfLat_rad!=0)&&(pLauncher->msDatum.mfLon_rad!=0); bool bTrackActive = (pLauncher->mnTargetID != NULL_INDEX); bool bReadyForLaunch; bool bLauncherActive = (nLaunchCount > 0) && (!pLauncher->isLoading); ! if (pLauncher->meLaunchMode == AUTO) *************** *** 778,784 **** { eLauncherState = BS_DISABLED; - eDatumState = BS_DISABLED; - eTargetState = BS_DISABLED; - eLaunchState = BS_DISABLED; } else --- 764,767 ---- *************** *** 792,798 **** eLauncherState = BS_READYING; } - eTargetState = bTrackActive ? BS_ACTIVE : BS_READY; - eDatumState = bDatumActive ? BS_ACTIVE : BS_READY; - eLaunchState = bReadyForLaunch ? BS_ACTIVE : BS_READY; } --- 775,778 ---- *************** *** 804,810 **** mcWeaponPanel.maButtonState[i][0] = eLauncherState; mcWeaponPanel.maButtonState[i][1] = eLauncherState; ! mcWeaponPanel.maButtonState[i][2] = eDatumState; ! mcWeaponPanel.maButtonState[i][3] = eTargetState; ! mcWeaponPanel.maButtonState[i][4] = eLaunchState; } mcWeaponPanel.Draw((tc3DWindow*)this); --- 784,788 ---- mcWeaponPanel.maButtonState[i][0] = eLauncherState; mcWeaponPanel.maButtonState[i][1] = eLauncherState; ! mcWeaponPanel.maButtonState[i][2] = eLauncherState; } mcWeaponPanel.Draw((tc3DWindow*)this); *************** *** 1399,1406 **** case 2: // "P" launcher programming, e.g. torpedo settings { ! tcLauncherPopup* popupControl = ! new tcLauncherPopup(mpHookedGameObj->mnID, anLauncher, wxPoint(220, 200)); ! ! return true; } break; --- 1377,1389 ---- case 2: // "P" launcher programming, e.g. torpedo settings { ! if (tcLauncher* launcher = mpHookedGameObj->GetLauncher(anLauncher)) ! { ! if (tcTorpedoDBObject* torpDBObj = dynamic_cast<tcTorpedoDBObject*>(launcher->mpChildDBObj)) ! { ! tcLauncherPopup* popupControl = ! new tcLauncherPopup(mpHookedGameObj->mnID, anLauncher, wxPoint(220, 200)); ! return true; ! } ! } } break; Index: tcSonar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSonar.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSonar.cpp 21 Dec 2004 02:26:18 -0000 1.4 --- tcSonar.cpp 10 Jan 2005 00:30:55 -0000 1.5 *************** *** 420,424 **** if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_PING); } fprintf(stdout, "%s (%s): target %d (%s) detected by active sonar at %3.1f km at time %.1f " --- 420,424 ---- if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_SONARDETECT); } fprintf(stdout, "%s (%s): target %d (%s) detected by active sonar at %3.1f km at time %.1f " *************** *** 480,484 **** if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_PING); } fprintf(stdout, "%s (%s): target %d (%s) detected by passive sonar at %3.1f km" --- 480,484 ---- if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_SONARDETECT); } fprintf(stdout, "%s (%s): target %d (%s) detected by passive sonar at %3.1f km" Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** Game.cpp 30 Dec 2004 17:26:07 -0000 1.114 --- Game.cpp 10 Jan 2005 00:30:54 -0000 1.115 *************** *** 2284,2288 **** else if (cmd_info.mbGetUserInput) { ! if (cmd_info.platformID == -1) cmd_info.platformID = tacticalMap->GetHookID(); GetUserInput(cmd_info.mzString, cmd_info.mzUserInput, cmd_info.platformID, cmd_info.mnData); --- 2284,2288 ---- else if (cmd_info.mbGetUserInput) { ! if (cmd_info.platformID.size() == 0) cmd_info.platformID = tacticalMap->GetHookedGroup(); GetUserInput(cmd_info.mzString, cmd_info.mzUserInput, cmd_info.platformID, cmd_info.mnData); *************** *** 2345,2349 **** * Calls Python callback */ ! void tcGame::ProcessCallback(char *azCallback, char *azUserInput, long id, int param) { if (strcmp(azUserInput,"Heading") == 0) --- 2345,2349 ---- * Calls Python callback */ ! void tcGame::ProcessCallback(char *azCallback, char *azUserInput, std::vector<long>& id, int param) { if (strcmp(azUserInput,"Heading") == 0) *************** *** 2369,2373 **** * Gets user input for Python call back and then calls Python callback */ ! void tcGame::GetUserInput(char *azCallback, char *azUserInput, long id, int param) { tacticalMap->SetMapCmdCallback(azCallback, id, param); --- 2369,2373 ---- * Gets user input for Python call back and then calls Python callback */ ! void tcGame::GetUserInput(char *azCallback, char *azUserInput, std::vector<long>& id, int param) { tacticalMap->SetMapCmdCallback(azCallback, id, param); |
|
From: Dewitt C. <ddc...@us...> - 2005-01-10 00:31:07
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27845/src/graphics Modified Files: tc3DModel.cpp tcLauncherPopup.cpp tcMapView.cpp Log Message: Fixed group commands Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcMapView.cpp 28 Dec 2004 23:51:24 -0000 1.13 --- tcMapView.cpp 10 Jan 2005 00:30:54 -0000 1.14 *************** *** 754,757 **** --- 754,765 ---- /** + * @return vector of hooked group indices + */ + std::vector<long>& tcTacticalMapView::GetHookedGroup() + { + return hookedId; + } + + /** * @return hook ID of hooked unit with index of idx, or -1 if invalid */ *************** *** 2307,2311 **** * Sets callback parameters to use when map command is completed */ ! void tcTacticalMapView::SetMapCmdCallback(const char *azCallback, long id, int param) { strcpy(mzMapCmdCallback,azCallback); --- 2315,2319 ---- * Sets callback parameters to use when map command is completed */ ! void tcTacticalMapView::SetMapCmdCallback(const char *azCallback, const std::vector<long>& id, int param) { strcpy(mzMapCmdCallback,azCallback); Index: tcLauncherPopup.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcLauncherPopup.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcLauncherPopup.cpp 21 Dec 2004 02:26:17 -0000 1.3 --- tcLauncherPopup.cpp 10 Jan 2005 00:30:54 -0000 1.4 *************** *** 167,171 **** const int widgetHeight = 12; const float widgetFontSize = 12.0; ! const float widgetAlpha = 0.9f; int x = 80; int y = 20; --- 167,171 ---- const int widgetHeight = 12; const float widgetFontSize = 12.0; ! const float widgetAlpha = 1.0f; int x = 80; int y = 20; *************** *** 288,292 **** if (tcLauncher* launcher = GetLauncher()) { ! tcCommandQueue::Get()->GetUserInputForID("SetDatum", "Datum", platformId, launcherIdx); } } --- 288,293 ---- if (tcLauncher* launcher = GetLauncher()) { ! tcCommandQueue::Get()->GetUserInputForID("SetDatum", "Datum", ! std::vector<long>(platformId), launcherIdx); } } Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tc3DModel.cpp 30 Dec 2004 17:26:07 -0000 1.18 --- tc3DModel.cpp 10 Jan 2005 00:30:54 -0000 1.19 *************** *** 611,621 **** // add children with varying level of detail ! modelGroup->addChild(modelNode.get(),0,200.0); modelGroup->addChild( dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,2.0f))) , 200.0, 500.0); modelGroup->addChild( ! dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,5.0f))) ! , 500.0, 10000.0); modelGroup->addChild( dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,10.0f))) --- 611,625 ---- // add children with varying level of detail ! modelGroup->addChild(modelNode.get(),0,300.0); ! ! /* modelGroup->addChild( dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,2.0f))) , 200.0, 500.0); + */ modelGroup->addChild( ! dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,4.0f))) ! , 300.0, 10000.0); ! modelGroup->addChild( dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,10.0f))) |
|
From: Dewitt C. <ddc...@us...> - 2005-01-10 00:31:04
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27845/src/scriptinterface Modified Files: tcGroupInterface.cpp tcSimPythonInterface.cpp Log Message: Fixed group commands Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcSimPythonInterface.cpp 11 Dec 2004 01:09:07 -0000 1.24 --- tcSimPythonInterface.cpp 10 Jan 2005 00:30:54 -0000 1.25 *************** *** 366,370 **** * */ ! void tcSimPythonInterface::ProcessCommand(std::string command, long id, int param, std::string textParam) { std::string s = "Menu."; --- 366,371 ---- * */ ! void tcSimPythonInterface::ProcessCommand(std::string command, const std::vector<long>& id, ! int param, std::string textParam) { std::string s = "Menu."; *************** *** 400,404 **** { pushedMode = meMenuMode; ! pushedPlatformID = menuPlatformID; isModePushed = true; } --- 401,407 ---- { pushedMode = meMenuMode; ! ! pushedPlatformIds = groupInterface->GetUnits(); ! isModePushed = true; } *************** *** 417,425 **** meMenuMode = pushedMode; - // for group menu don't do anything (can't change group menu currently) - if (meMenuMode == GROUP_MENU) return; - // reselect menu platform ! SetMenuPlatform(pushedPlatformID); isModePushed = false; --- 420,427 ---- meMenuMode = pushedMode; // reselect menu platform ! SetMenuGroup(pushedPlatformIds); ! ! pushedPlatformIds.clear(); isModePushed = false; *************** *** 432,439 **** * */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, float afData, int param) { PushMode(); ! SetMenuPlatform(id); if (mpHookedObj == NULL) --- 434,442 ---- * */ ! void tcSimPythonInterface::ProcessCallback(std::string command, const std::vector<long>& id, ! float afData, int param) { PushMode(); ! SetMenuGroup(id); if (mpHookedObj == NULL) *************** *** 462,470 **** * version for sending lat/lon coordinates */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, float afData1, float afData2, int param) { PushMode(); ! SetMenuPlatform(id); if (mpHookedObj == NULL) --- 465,473 ---- * version for sending lat/lon coordinates */ ! void tcSimPythonInterface::ProcessCallback(std::string command, const std::vector<long>& id, float afData1, float afData2, int param) { PushMode(); ! SetMenuGroup(id); if (mpHookedObj == NULL) *************** *** 492,499 **** * */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, long anData, int param) { PushMode(); ! SetMenuPlatform(id); if (mpHookedObj == NULL) --- 495,503 ---- * */ ! void tcSimPythonInterface::ProcessCallback(std::string command, const std::vector<long>& id, ! long anData, int param) { PushMode(); ! SetMenuGroup(id); if (mpHookedObj == NULL) *************** *** 583,587 **** ! void tcSimPythonInterface::SetMenuGroup(std::vector<long>& unitIds) { // if any of the ids are invalid or not own-alliance, then return --- 587,591 ---- ! void tcSimPythonInterface::SetMenuGroup(const std::vector<long>& unitIds) { // if any of the ids are invalid or not own-alliance, then return *************** *** 598,604 **** } ! meMenuMode = GROUP_MENU; ! ! groupInterface->SetUnits(unitIds); } --- 602,618 ---- } ! if (unitIds.size() > 1) ! { ! meMenuMode = GROUP_MENU; ! groupInterface->SetUnits(unitIds); ! } ! else if (unitIds.size() > 0) ! { ! SetMenuPlatform(unitIds[0]); ! } ! else ! { ! fprintf(stderr, "tcSimPythonInterface::SetMenuGroup - empty unitIds\n"); ! } } *************** *** 612,616 **** if (mpHookedObj && (mpHookedObj->mnID == anID)) return; // already set ! menuPlatformID = anID; tcTrackInterface::SetTrack(anID); --- 626,630 ---- if (mpHookedObj && (mpHookedObj->mnID == anID)) return; // already set ! groupInterface->SetUnit(anID); tcTrackInterface::SetTrack(anID); *************** *** 659,667 **** director(0), mpHookedObj(0), ! isModePushed(false), ! pushedPlatformID(-1) ! { - mpSimState = tcSimState::Get(); --- 673,678 ---- director(0), mpHookedObj(0), ! isModePushed(false) { mpSimState = tcSimState::Get(); Index: tcGroupInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcGroupInterface.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcGroupInterface.cpp 16 Aug 2004 01:43:31 -0000 1.1 --- tcGroupInterface.cpp 10 Jan 2005 00:30:54 -0000 1.2 *************** *** 81,89 **** return groupUnits[idx]; } ! } /** * */ ! void tcGroupInterface::SetUnits(std::vector<long>& units) { groupUnits = units; --- 81,107 ---- return groupUnits[idx]; } ! } ! ! /** ! * ! */ ! std::vector<long>& tcGroupInterface::GetUnits() ! { ! return groupUnits; ! } ! ! /** ! * ! */ ! void tcGroupInterface::SetUnit(long unit) ! { ! groupUnits.clear(); ! groupUnits.push_back(unit); ! } ! /** * */ ! void tcGroupInterface::SetUnits(const std::vector<long>& units) { groupUnits = units; |
|
From: Dewitt C. <ddc...@us...> - 2005-01-10 00:31:03
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27845/src/common Modified Files: tcOggStreamer.cpp tcSound.cpp Log Message: Fixed group commands Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcOggStreamer.cpp 7 Dec 2004 04:00:28 -0000 1.12 --- tcOggStreamer.cpp 10 Jan 2005 00:30:46 -0000 1.13 *************** *** 290,294 **** { ! alSourceStop(source); alSourcePlay(source); // crashes frequently in OpenAL32.dll thread after here --- 290,294 ---- { ! //alSourceStop(source); alSourcePlay(source); // crashes frequently in OpenAL32.dll thread after here *************** *** 296,300 **** fprintf(stderr, "tcOggStreamer::Update - Restarting source\n"); #endif ! return true; } --- 296,300 ---- fprintf(stderr, "tcOggStreamer::Update - Restarting source\n"); #endif ! //return true; } Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcSound.cpp 7 Nov 2004 03:40:43 -0000 1.18 --- tcSound.cpp 10 Jan 2005 00:30:46 -0000 1.19 *************** *** 112,115 **** --- 112,117 ---- LoadWavDataFromFile("radar_on.wav", SEFFECT_RADARON); LoadWavDataFromFile("radar_off.wav", SEFFECT_RADAROFF); + LoadWavDataFromFile("torpedo_launch.wav", SEFFECT_TORPEDOLAUNCH); + LoadWavDataFromFile("shishding.wav", SEFFECT_SONARDETECT); if((alGetError())!=AL_NO_ERROR) |
|
From: Dewitt C. <ddc...@us...> - 2005-01-10 00:30:34
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27758/include/graphics Modified Files: tcMapView.h Log Message: Fixed group commands Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcMapView.h 28 Dec 2004 23:51:24 -0000 1.10 --- tcMapView.h 10 Jan 2005 00:30:20 -0000 1.11 *************** *** 274,278 **** char mzMapCmdCallback[128]; int callbackParam; ! long callbackPlatformID; ///< platform ID for callback --- 274,278 ---- char mzMapCmdCallback[128]; int callbackParam; ! std::vector<long> callbackPlatformID; ///< platform ID vector for callback *************** *** 285,289 **** float GetMapCmdHeading() {return mfMapCmdHeading;} long GetMapCmdTarget() {return mnMapCmdTarget;} ! void SetMapCmdCallback(const char *azCallback, long id, int param = -1); void SetMousePoint(wxPoint point) {mpointMouse = point;} // used to be TranslatePoint(point); void ScrollMap(float afDirection_deg); --- 285,289 ---- float GetMapCmdHeading() {return mfMapCmdHeading;} long GetMapCmdTarget() {return mnMapCmdTarget;} ! void SetMapCmdCallback(const char *azCallback, const std::vector<long>& id, int param = -1); void SetMousePoint(wxPoint point) {mpointMouse = point;} // used to be TranslatePoint(point); void ScrollMap(float afDirection_deg); *************** *** 300,303 **** --- 300,304 ---- void DrawSpecial(); size_t GetHookCount(); + std::vector<long>& GetHookedGroup(); long GetHookID(size_t idx = 0); long Hook(wxPoint pscreen); |
|
From: Dewitt C. <ddc...@us...> - 2005-01-10 00:30:34
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27758/include/sim Modified Files: Game.h commandlist.h tcCommandQueue.h Log Message: Fixed group commands Index: tcCommandQueue.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCommandQueue.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcCommandQueue.h 11 Dec 2004 01:09:05 -0000 1.1 --- tcCommandQueue.h 10 Jan 2005 00:30:21 -0000 1.2 *************** *** 55,64 **** void GetUserInputForID(const char *azCallback, const char *azUserInput, ! long platformID, int param = -1) ; void AddPythonCallback(const char *azCallback, const char *azUserInput, int param = -1) ; void AddPythonCallbackForID(const char *azCallback, const char *azUserInput, ! long platformID, int param = -1) ; void DisplayInfoMessage(const char *azString); --- 55,64 ---- void GetUserInputForID(const char *azCallback, const char *azUserInput, ! std::vector<long>& platformID, int param = -1) ; void AddPythonCallback(const char *azCallback, const char *azUserInput, int param = -1) ; void AddPythonCallbackForID(const char *azCallback, const char *azUserInput, ! std::vector<long>& platformID, int param = -1) ; void DisplayInfoMessage(const char *azString); Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Game.h 28 Dec 2004 00:54:21 -0000 1.52 --- Game.h 10 Jan 2005 00:30:20 -0000 1.53 *************** *** 230,234 **** bool Finish(); teMenuMode GetMenuMode(); ! void GetUserInput(char *azCallback, char *azUserInput, long id, int param = -1); ///< for python interface void Init(); ///< basic initialization and start screen init bool InitGame(); ///< game initialization called prior to starting game --- 230,234 ---- bool Finish(); teMenuMode GetMenuMode(); ! void GetUserInput(char *azCallback, char *azUserInput, std::vector<long>& id, int param = -1); ///< for python interface void Init(); ///< basic initialization and start screen init bool InitGame(); ///< game initialization called prior to starting game *************** *** 250,254 **** void OnPaint(wxPaintEvent& event); void OnRButtonDown(wxMouseEvent& event); ! void ProcessCallback(char *azCallback, char *azUserInput, long id, int param = -1); ///< for python interface void ProcessCommandList(); void ProcessEsc(); --- 250,255 ---- void OnPaint(wxPaintEvent& event); void OnRButtonDown(wxMouseEvent& event); ! void ProcessCallback(char *azCallback, char *azUserInput, ! std::vector<long>& id, int param = -1); ///< for python interface void ProcessCommandList(); void ProcessEsc(); Index: commandlist.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/commandlist.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** commandlist.h 11 Dec 2004 01:09:05 -0000 1.6 --- commandlist.h 10 Jan 2005 00:30:21 -0000 1.7 *************** *** 29,32 **** --- 29,33 ---- #include <string> + #include <vector> /** *************** *** 75,79 **** bool mbGetUserInput; std::string textParam; ///< string parameter for python ! long platformID; ///< -1 to use current hooked }; --- 76,80 ---- bool mbGetUserInput; std::string textParam; ///< string parameter for python ! std::vector<long> platformID; ///< -1 or empty to use current hooked }; |
|
From: Dewitt C. <ddc...@us...> - 2005-01-10 00:30:29
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27758/include/scriptinterface Modified Files: tcGroupInterface.h tcSimPythonInterface.h Log Message: Fixed group commands Index: tcGroupInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcGroupInterface.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcGroupInterface.h 16 Aug 2004 01:43:30 -0000 1.1 --- tcGroupInterface.h 10 Jan 2005 00:30:20 -0000 1.2 *************** *** 49,54 **** /// unit id of unit <idx> in group, -1 for error long GetUnitId(int idx); /// sets id vector for units in group ! void SetUnits(std::vector<long>& units); static void AttachSimState(tcSimState* ss) {simState = ss;} --- 49,58 ---- /// unit id of unit <idx> in group, -1 for error long GetUnitId(int idx); + /// vector of unit ids + std::vector<long>& GetUnits(); + /// sets id vector for single unit in group + void SetUnit(long unit); /// sets id vector for units in group ! void SetUnits(const std::vector<long>& units); static void AttachSimState(tcSimState* ss) {simState = ss;} Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcSimPythonInterface.h 11 Dec 2004 01:09:05 -0000 1.18 --- tcSimPythonInterface.h 10 Jan 2005 00:30:20 -0000 1.19 *************** *** 101,108 **** void GetObjectStringByMode(char *str); // gets name of python object to pass to python function void LoadScenario(const char *filePath, const char *fileName); ///< loads scenario from Python script file ! void ProcessCommand(std::string command, long id, int param = -1, std::string textParam = ""); ! void ProcessCallback(std::string command, long id, float afData, int param); ! void ProcessCallback(std::string command, long id, float afData1, float afData2, int param); ! void ProcessCallback(std::string command, long id, long anData, int param); void ProcessHotKey(unsigned int key, unsigned int flags); void ProcessSecondaryHook(long id); --- 101,112 ---- void GetObjectStringByMode(char *str); // gets name of python object to pass to python function void LoadScenario(const char *filePath, const char *fileName); ///< loads scenario from Python script file ! void ProcessCommand(std::string command, const std::vector<long>& id, ! int param = -1, std::string textParam = ""); ! void ProcessCallback(std::string command, const std::vector<long>& id, ! float afData, int param); ! void ProcessCallback(std::string command, const std::vector<long>& id, ! float afData1, float afData2, int param); ! void ProcessCallback(std::string command, const std::vector<long>& id, ! long anData, int param); void ProcessHotKey(unsigned int key, unsigned int flags); void ProcessSecondaryHook(long id); *************** *** 115,119 **** void SelectGroupMenu(); ///< change to group menu void SetMenuPlatform(long anID); ! void SetMenuGroup(std::vector<long>& unitIds); tcSimPythonInterface(); --- 119,123 ---- void SelectGroupMenu(); ///< change to group menu void SetMenuPlatform(long anID); ! void SetMenuGroup(const std::vector<long>& unitIds); tcSimPythonInterface(); *************** *** 143,147 **** tcPlatformObject *mpHookedObj; tcSoundConsole *mpConsole; ! long menuPlatformID; enum teInterfaceMode { --- 147,151 ---- tcPlatformObject *mpHookedObj; tcSoundConsole *mpConsole; ! enum teInterfaceMode { *************** *** 154,158 **** bool isModePushed; ///< true if mode is pushed and available for recall with PopMode teInterfaceMode pushedMode; ! long pushedPlatformID; tcFlightPort* GetHookedObjFlightPort(); --- 158,162 ---- bool isModePushed; ///< true if mode is pushed and available for recall with PopMode teInterfaceMode pushedMode; ! std::vector<long> pushedPlatformIds; tcFlightPort* GetHookedObjFlightPort(); |
|
From: Dewitt C. <ddc...@us...> - 2005-01-10 00:30:29
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27758/include/common Modified Files: tcSound.h Log Message: Fixed group commands Index: tcSound.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcSound.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcSound.h 7 Nov 2004 03:40:43 -0000 1.15 --- tcSound.h 10 Jan 2005 00:30:20 -0000 1.16 *************** *** 65,70 **** #define SEFFECT_RADARON 24 #define SEFFECT_RADAROFF 25 ! #define N_SEFFECT 26 #define N_EFFECT_BUFFERS 16 --- 65,72 ---- #define SEFFECT_RADARON 24 #define SEFFECT_RADAROFF 25 + #define SEFFECT_TORPEDOLAUNCH 26 + #define SEFFECT_SONARDETECT 27 ! #define N_SEFFECT 28 #define N_EFFECT_BUFFERS 16 |
|
From: Dewitt C. <ddc...@us...> - 2004-12-30 17:26:23
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/src/sim Modified Files: Game.cpp Log Message: Group selection Ctrl and Alt+number commands Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** Game.cpp 28 Dec 2004 23:51:25 -0000 1.113 --- Game.cpp 30 Dec 2004 17:26:07 -0000 1.114 *************** *** 1957,1961 **** { int nChar = event.GetKeyCode(); ! bool controlDown = event.ControlDown(); bool altDown = event.AltDown(); --- 1957,1961 ---- { int nChar = event.GetKeyCode(); ! bool controlDown = (event.ControlDown() && (nChar != WXK_CONTROL)); bool altDown = event.AltDown(); *************** *** 1979,1982 **** --- 1979,1983 ---- groupCtrl->SetGroup(val, hookedUnits); s = wxString::Format("Formed group %d (%d units)\n", val, hookedUnits.size()); + DisplayMessage(s.c_str()); } return; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-30 17:26:22
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/src/database Modified Files: tcDatabaseObject.cpp tcGenericDBObject.cpp Log Message: Group selection Ctrl and Alt+number commands Index: tcDatabaseObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabaseObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcDatabaseObject.cpp 29 Nov 2004 03:55:04 -0000 1.13 --- tcDatabaseObject.cpp 30 Dec 2004 17:26:06 -0000 1.14 *************** *** 110,114 **** tc3DModel* tcDatabaseObject::Get3DModel() { - wxASSERT(model); if (model) { --- 110,113 ---- *************** *** 117,121 **** else { ! return NULL; } } --- 116,129 ---- else { ! Load3DModel(); ! if (model) ! { ! return model->Clone(); ! } ! else ! { ! wxASSERT(false); ! return NULL; ! } } } *************** *** 283,287 **** strncpy(mzDescription, desc.c_str(),DESCRIPTION_STRING_LENGTH-1); ! Load3DModel(); } --- 291,295 ---- strncpy(mzDescription, desc.c_str(),DESCRIPTION_STRING_LENGTH-1); ! //Load3DModel(); // do lazy load instead } Index: tcGenericDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcGenericDBObject.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcGenericDBObject.cpp 7 Dec 2004 04:00:28 -0000 1.16 --- tcGenericDBObject.cpp 30 Dec 2004 17:26:06 -0000 1.17 *************** *** 53,57 **** { //if (animationInfo.size()==0) return; // no animation in this model ! model->ProcessAnimations(animationInfo); } --- 53,82 ---- { //if (animationInfo.size()==0) return; // no animation in this model ! if (model) ! { ! model->ProcessAnimations(animationInfo); ! } ! } ! ! tc3DModel* tcGenericDBObject::Get3DModel() ! { ! if (model) ! { ! return model->Clone(); ! } ! else ! { ! Load3DModel(); ! Animate3DModel(); ! if (model) ! { ! return model->Clone(); ! } ! else ! { ! return NULL; ! } ! } ! } |