gcblue-commits Mailing List for Global Conflict Blue (Page 62)
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...> - 2004-03-20 18:56:48
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4103/src/sim Modified Files: Game.cpp tcCreditView.cpp tcMapView.cpp tcNetworkView.cpp tcScenarioSelectView.cpp tcTerrainView.cpp Log Message: Moved 2D surface creation code into tcWindow. Created docs folder Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcNetworkView.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcNetworkView.cpp 6 Mar 2004 20:52:29 -0000 1.6 --- tcNetworkView.cpp 20 Mar 2004 18:46:47 -0000 1.7 *************** *** 200,210 **** tcNetworkView::tcNetworkView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name) ! : tcStandardWindow(parent, pos, size, "xml/network_view.xml", name), networkMode(0) { wxASSERT(surfaceHost); - ShareSurfaceWith(surfaceHost); - LoadBackgroundImage("background.jpg"); --- 200,208 ---- tcNetworkView::tcNetworkView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name) ! : tcStandardWindow(parent, pos, size, "xml/network_view.xml", name, surfaceHost), networkMode(0) { wxASSERT(surfaceHost); LoadBackgroundImage("background.jpg"); Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCreditView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcCreditView.cpp 29 Feb 2004 22:51:36 -0000 1.9 --- tcCreditView.cpp 20 Mar 2004 18:46:46 -0000 1.10 *************** *** 324,329 **** tcCreditView::tcCreditView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, const wxString& name) ! : tcWindow(parent, pos, size, name) { mpFont = NULL; --- 324,330 ---- tcCreditView::tcCreditView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, ! const wxString& name, tcWindow *sharedSurface) ! : tcWindow(parent, pos, size, name, sharedSurface) { mpFont = NULL; *************** *** 335,339 **** } ! tcCreditView::~tcCreditView() { if (mpFont != NULL) {delete mpFont;} if (mpFontLarge != NULL) {delete mpFontLarge;} --- 336,341 ---- } ! tcCreditView::~tcCreditView() ! { if (mpFont != NULL) {delete mpFont;} if (mpFontLarge != NULL) {delete mpFontLarge;} Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcScenarioSelectView.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcScenarioSelectView.cpp 29 Feb 2004 22:51:36 -0000 1.13 --- tcScenarioSelectView.cpp 20 Mar 2004 18:46:47 -0000 1.14 *************** *** 492,497 **** tcScenarioSelectView::tcScenarioSelectView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, const wxString& name) ! : tcWindow(parent, pos, size, name) { mpOptions = NULL; --- 492,498 ---- tcScenarioSelectView::tcScenarioSelectView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, ! const wxString& name, tcWindow *sharedSurface) ! : tcWindow(parent, pos, size, name, sharedSurface) { mpOptions = NULL; *************** *** 517,521 **** } ! tcScenarioSelectView::~tcScenarioSelectView() { if (mpFont != NULL) {delete mpFont;} if (mpBrush != NULL) {delete mpBrush;} --- 518,523 ---- } ! tcScenarioSelectView::~tcScenarioSelectView() ! { if (mpFont != NULL) {delete mpFont;} if (mpBrush != NULL) {delete mpBrush;} Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcMapView.cpp 29 Feb 2004 22:51:36 -0000 1.19 --- tcMapView.cpp 20 Mar 2004 18:46:46 -0000 1.20 *************** *** 201,205 **** } /***********************************************************************************/ ! void tcMapView::SetView(tcPoint center, float afLonSpan) { float fLatSpan; float fMaxLonSpan, fMaxLatSpan; --- 201,206 ---- } /***********************************************************************************/ ! void tcMapView::SetView(tcPoint center, float afLonSpan) ! { float fLatSpan; float fMaxLonSpan, fMaxLatSpan; *************** *** 213,217 **** if (afLonSpan > fMaxLonSpan) {afLonSpan = fMaxLonSpan;} fLatSpan = afLonSpan*mnHeight/mnWidth; ! if (fLatSpan > fMaxLatSpan) { fLatSpan = fMaxLatSpan; afLonSpan = fLatSpan*mnWidth/mnHeight; --- 214,219 ---- if (afLonSpan > fMaxLonSpan) {afLonSpan = fMaxLonSpan;} fLatSpan = afLonSpan*mnHeight/mnWidth; ! if (fLatSpan > fMaxLatSpan) ! { fLatSpan = fMaxLatSpan; afLonSpan = fLatSpan*mnWidth/mnHeight; *************** *** 223,227 **** mrectCurrentView = newview; ! if (newview.left > newview.right) { WTLC("wrap error"); } --- 225,230 ---- mrectCurrentView = newview; ! if (newview.left > newview.right) ! { WTLC("wrap error"); } *************** *** 230,234 **** } /***********************************************************************************/ ! void tcMapView::SetActive(bool abActive) { tcWindow::SetActive(abActive); terrainView->SetActive(abActive); --- 233,238 ---- } /***********************************************************************************/ ! void tcMapView::SetActive(bool abActive) ! { tcWindow::SetActive(abActive); terrainView->SetActive(abActive); *************** *** 241,255 **** } */ ! /***********************************************************************************/ ! int tcMapView::CreateSurfaces(tcGraphicsEngine* apGraphicsEngine) { ! if (mpMapData == NULL) { ! wxMessageBox("Error - tcMapView - CreateSurfaces called before attaching tcMapData obj"); ! } ! else { ! if (terrainView->CreateSurfaces(apGraphicsEngine) == false) {return false;} ! } ! WTL("tcMapView - CreateSurfaces - called"); ! return tcWindow::CreateSurfaces(apGraphicsEngine); // MapView on top of TerrainView ! } --- 245,249 ---- } */ ! *************** *** 258,265 **** const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcWindow(parent, pos, size, name) { - terrainView = new tcTerrainView(parent, pos, size); - if (!terrainView) {wxMessageBox("terrainView init failed\n");} mpCommandInterface = NULL; --- 252,258 ---- const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcWindow(parent, pos, size, name), ! terrainView(NULL) { mpCommandInterface = NULL; *************** *** 314,317 **** --- 307,311 ---- * tc2DGraphicsSurface bitmap. */ + /* int tcTacticalMapView::CreateSurfaces(tcGraphicsEngine* apGraphicsEngine) { *************** *** 328,331 **** --- 322,326 ---- return tcWindow::CreateSurfaces(apGraphicsEngine); // MapView on top of TerrainView } + */ /***********************************************************************************/ *************** *** 502,506 **** /***********************************************************************************/ ! int tcTacticalMapView::Draw() { Graphics *pGraphics; int i; --- 497,502 ---- /***********************************************************************************/ ! int tcTacticalMapView::Draw() ! { Graphics *pGraphics; int i; *************** *** 1391,1395 **** } /***********************************************************************************/ ! void tcTacticalMapView::Init() { tcPoint p; --- 1387,1392 ---- } /***********************************************************************************/ ! void tcTacticalMapView::Init() ! { tcPoint p; *************** *** 1615,1622 **** const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) { ! //terrainView = new tcTerrainView(parent, pos, size); ! //if (!terrainView) {wxMessageBox("terrainView init failed\n");} mbBypassPythonCallback = false; mnCounter = 0; --- 1612,1626 ---- const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) ! { ! terrainView = new tcTerrainView(parent, pos, size, true); ! if (!terrainView) ! { ! wxMessageBox("terrainView init failed\n"); ! } ! ! tcWindow::MoveToTop(); // so that color elevation map is underneath ! mbBypassPythonCallback = false; mnCounter = 0; *************** *** 1836,1843 **** const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) { ! terrainView = new tcTerrainView(parent, pos, size); ! terrainView->SetActive(false); mnCounter = 0; ClearMapObjects(); --- 1840,1848 ---- const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) { ! terrainView = new tcTerrainView(parent, pos, size, false); ! if (!terrainView) {wxMessageBox("terrainView init failed\n");} ! mnCounter = 0; ClearMapObjects(); Index: tcTerrainView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTerrainView.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcTerrainView.cpp 1 Feb 2004 22:19:09 -0000 1.8 --- tcTerrainView.cpp 20 Mar 2004 18:46:47 -0000 1.9 *************** *** 2,6 **** ** tcTerrainView.cpp ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcTerrainView.cpp ** ! ** Copyright (C) 2003-2004 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. *************** *** 116,120 **** mp2DSurface->SetRenderTexture(true); - mp2DSurface->SetActive(true); mp2DSurface->mbModified = true; --- 116,119 ---- *************** *** 161,165 **** mp2DSurface->mbModified = true; mp2DSurface->SetRenderTexture(mbTextureMaps); - mp2DSurface->SetActive(true); return true; --- 160,163 ---- *************** *** 212,221 **** tcTerrainView::tcTerrainView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcWindow(parent, pos, size, name) { mpMapData = NULL; mpOptions = NULL; - mbHighRes = true; // set true for high resolution surface SetResizeable2D(false); // do not resize 2D surface on resize } --- 210,220 ---- tcTerrainView::tcTerrainView(wxWindow *parent, const wxPoint& pos, const wxSize& size, + bool isHighRes, const wxString& name) : ! mbHighRes(isHighRes), ! tcWindow(parent, pos, size, name) { mpMapData = NULL; mpOptions = NULL; SetResizeable2D(false); // do not resize 2D surface on resize } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Game.cpp 6 Mar 2004 20:52:29 -0000 1.68 --- Game.cpp 20 Mar 2004 18:46:46 -0000 1.69 *************** *** 196,213 **** } /** ! * Skips to the end of the briefing and starts game */ ! void tcGame::SkipBriefing(wxCommandEvent& event) ! { ! if (meScreenMode != TACTICALBRIEF) return; // ignore if not in tactical briefing mode ! directorTime = 1e10; // set directorTime to large value to skip to end ! ! // deactivate delayed text so that briefing text is quickly available ! briefingConsoleLeft->SetDelayedTextEffect(false); ! } ! ! void tcGame::StartGame(wxCommandEvent& event) { if (InitGame()) { --- 196,206 ---- } + /** ! * Ends game and returns to start screen */ ! void tcGame::EndGame(wxCommandEvent& event) { + /* if (InitGame()) { *************** *** 243,246 **** --- 236,271 ---- wxMessageBox("Error starting game","ERROR",wxICON_ERROR); } + */ + } + + + /** + * Skips to the end of the briefing and starts game + */ + void tcGame::SkipBriefing(wxCommandEvent& event) + { + if (meScreenMode != TACTICALBRIEF) return; // ignore if not in tactical briefing mode + directorTime = 1e10; // set directorTime to large value to skip to end + + // deactivate delayed text so that briefing text is quickly available + briefingConsoleLeft->SetDelayedTextEffect(false); + } + + void tcGame::StartGame(wxCommandEvent& event) + { + if (InitGame()) + { + optionsView->SetActive(false); + startView->SetActive(false); + creditView->SetActive(false); + scenarioSelectView->SetActive(false); + + meGameMode = GM_PLAY; + meScreenMode = TACTICAL; + } + else + { + wxMessageBox("Error starting game","ERROR",wxICON_ERROR); + } } *************** *** 346,352 **** /* ** Init graphics engine * **/ ! mpGraphicsEngine = new tcGraphicsEngine; ! InitializeStartView(); InitializeOptionsView(); InitializeCreditView(); --- 371,379 ---- /* ** Init graphics engine * **/ ! mpGraphicsEngine = tcGraphicsEngine::Get(); ! /* start view has to be initialized first so that we can ! share its 2D surface with the other windows */ ! InitializeStartView(); InitializeOptionsView(); InitializeCreditView(); *************** *** 358,361 **** --- 385,389 ---- /*** Init edit control ***/ editControl = new tcEditControl(glCanvas, wxPoint(200,200),wxSize(100,50)); + editControl->SetActive(false); mcDatabase.LoadDBCSV(); *************** *** 467,477 **** startView = new tcStartView(glCanvas, wxPoint(0,0), frameSize); - startView->SetYMirror(mnHeight); - - if (!startView->CreateSurfaces(mpGraphicsEngine)) - { - throw exception(); - } - startView->AttachOptions(&mcOptions); startView->LoadBackgroundImage("start_background.jpg"); --- 495,498 ---- *************** *** 491,502 **** void tcGame::InitializeOptionsView() { ! optionsView = new tcOptionsView(glCanvas, wxPoint(0,0), frameSize); ! ! optionsView->SetYMirror(mnHeight); ! ! if(!optionsView->CreateSurfaces(mpGraphicsEngine)) ! { ! throw exception(); ! } optionsView->AttachOptions(&mcOptions); --- 512,518 ---- void tcGame::InitializeOptionsView() { ! wxASSERT(startView); ! optionsView = new tcOptionsView(glCanvas, wxPoint(0,0), frameSize, ! "OptionsView", startView); optionsView->AttachOptions(&mcOptions); *************** *** 517,522 **** { networkView = new tcNetworkView(glCanvas, startView, wxPoint(0,0), frameSize); - networkView->SetYMirror(mnHeight); - networkView->SetActive(false); } --- 533,536 ---- *************** *** 535,543 **** throw "briefingConsoleLeft init failed\n"; } ! briefingConsoleLeft->SetYMirror(mnHeight); ! if(!briefingConsoleLeft->CreateSurfaces(mpGraphicsEngine)) ! { ! throw "briefingConsoleLeft->CreateSurfaces failed"; ! } briefingConsoleLeft->SetEffect(SEFFECT_MUTEDBEEP); briefingConsoleLeft->InitGdi(10.0f,0xFF64FF64); --- 549,553 ---- throw "briefingConsoleLeft init failed\n"; } ! briefingConsoleLeft->SetEffect(SEFFECT_MUTEDBEEP); briefingConsoleLeft->InitGdi(10.0f,0xFF64FF64); *************** *** 559,567 **** throw "briefingConsoleBottom init failed\n"; } ! briefingConsoleBottom->SetYMirror(mnHeight); ! if(!briefingConsoleBottom->CreateSurfaces(mpGraphicsEngine)) ! { ! throw "briefingConsoleBottom->CreateSurfaces failed"; ! } briefingConsoleBottom->SetEffect(-1); briefingConsoleBottom->InitGdi(10.0f,0xFF64FF64); --- 569,573 ---- throw "briefingConsoleBottom init failed\n"; } ! briefingConsoleBottom->SetEffect(-1); briefingConsoleBottom->InitGdi(10.0f,0xFF64FF64); *************** *** 580,591 **** void tcGame::InitializeCreditView() { ! creditView = new tcCreditView(glCanvas, wxPoint(0,0), frameSize); ! ! creditView->SetYMirror(mnHeight); ! ! if(!creditView->CreateSurfaces(mpGraphicsEngine)) ! { ! throw exception(); ! } creditView->LoadBackgroundImage("start_background.jpg"); --- 586,592 ---- void tcGame::InitializeCreditView() { ! wxASSERT(startView); ! creditView = new tcCreditView(glCanvas, wxPoint(0,0), frameSize, ! "CreditView", startView); creditView->LoadBackgroundImage("start_background.jpg"); *************** *** 618,629 **** void tcGame::InitializeScenarioSelectView() { ! scenarioSelectView = new tcScenarioSelectView(glCanvas, wxPoint(0,0), frameSize); ! ! scenarioSelectView->SetYMirror(mnHeight); ! ! if(!scenarioSelectView->CreateSurfaces(mpGraphicsEngine)) ! { ! throw exception(); ! } scenarioSelectView->AttachSimState(&mcSimState); --- 619,625 ---- void tcGame::InitializeScenarioSelectView() { ! wxASSERT(startView); ! scenarioSelectView = new tcScenarioSelectView(glCanvas, ! wxPoint(0,0), frameSize, "ScenarioSelect", startView); scenarioSelectView->AttachSimState(&mcSimState); *************** *** 644,648 **** mrectMap.right = mnWidth; //GetSystemMetrics(SM_CXFULLSCREEN); mrectMap.bottom = mnHeight - 200; //GetSystemMetrics(SM_CYFULLSCREEN); ! tacticalMap = new tcTacticalMapView(glCanvas, wxPoint(mrectMap.left,mrectMap.top), wxSize(mrectMap.right-mrectMap.left, mrectMap.bottom-mrectMap.top)); tacticalMapSize = TM_LARGE; --- 640,645 ---- mrectMap.right = mnWidth; //GetSystemMetrics(SM_CXFULLSCREEN); mrectMap.bottom = mnHeight - 200; //GetSystemMetrics(SM_CYFULLSCREEN); ! tacticalMap = new tcTacticalMapView(glCanvas, wxPoint(mrectMap.left,mrectMap.top), ! wxSize(mrectMap.right-mrectMap.left, mrectMap.bottom-mrectMap.top)); tacticalMapSize = TM_LARGE; *************** *** 656,669 **** tacticalMap->AttachOptions(&mcOptions); tacticalMap->AttachCommandInterface(&mcCommandQueue); - tacticalMap->SetYMirror(mnHeight); // was 200 - - if(!tacticalMap->CreateSurfaces(mpGraphicsEngine)) - { - throw "tacticalMap->CreateSurfaces failed"; - } tacticalMap->Init(); tacticalMap->SetActive(false); tacticalMap->SetBlend(true); } --- 653,661 ---- tacticalMap->AttachOptions(&mcOptions); tacticalMap->AttachCommandInterface(&mcCommandQueue); tacticalMap->Init(); tacticalMap->SetActive(false); tacticalMap->SetBlend(true); + tacticalMap->RefreshTerrainView(); } *************** *** 684,694 **** } - infoConsole->SetYMirror(mnHeight);// was -mrectLowerLeft.top - - if(!infoConsole->CreateSurfaces(mpGraphicsEngine)) - { - return false; - } - infoConsole->SetEffect(-1); //SEFFECT_MUTEDBEEP); // no sound infoConsole->InitGdi(10.0f,0xFF64FF64); --- 676,679 ---- *************** *** 709,719 **** } - hookInfo->SetYMirror(mnHeight); // was -mrectLowerLeft.top - - if(!hookInfo->CreateSurfaces(mpGraphicsEngine)) - { - return false; - } - hookInfo->LoadBackgroundImage("console_b.jpg"); hookInfo->AttachSimState(&mcSimState); --- 694,697 ---- *************** *** 732,742 **** } - objectControl->SetYMirror(mnHeight); - objectControl->LoadBackgroundImage("console_b.jpg"); ! if(!objectControl->CreateSurfaces(mpGraphicsEngine)) ! { ! return false; ! } objectControl->AttachCommandInterface(&mcCommandQueue); --- 710,715 ---- } ! objectControl->LoadBackgroundImage("console_b.jpg"); objectControl->AttachCommandInterface(&mcCommandQueue); *************** *** 759,769 **** } - oobView->SetYMirror(mnHeight); // was -mrectLowerLeft.top - oobView->LoadBackgroundImage("console_b.jpg"); ! if(!oobView->CreateSurfaces(mpGraphicsEngine)) ! { ! return false; ! } oobView->AttachMapView(tacticalMap); --- 732,737 ---- } ! oobView->LoadBackgroundImage("console_b.jpg"); oobView->AttachMapView(tacticalMap); *************** *** 787,797 **** } - popupControl->SetYMirror(mnHeight); - - if(!popupControl->CreateSurfaces(mpGraphicsEngine)) - { - return false; - } - popupControl->AttachCommandInterface(&mcCommandQueue); popupControl->AttachPythonInterface(pythonInterface); --- 755,758 ---- *************** *** 845,848 **** --- 806,811 ---- } + + bool tcGame::InitSim() { *************** *** 1383,1390 **** --- 1346,1356 ---- bool tcGame::Finish() { + mpGraphicsEngine->DeleteAllSurfaces(); + /* if (mpGraphicsEngine != NULL) { delete mpGraphicsEngine; } + */ tcSound::Get()->UnInit(); |
|
From: Dewitt C. <ddc...@us...> - 2004-03-20 18:56:47
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4103/docs Added Files: BUILDING.txt CHANGES.txt Log Message: Moved 2D surface creation code into tcWindow. Created docs folder --- NEW FILE: BUILDING.txt --- --- Download information --- * OpenSceneGraph 0.9.6-2 and OpenThreads-v1.2dev3 http://openscenegraph.sourceforge.net/downloads/index.html Follow links to Sourceforge download page. Download bundled OSG_OT_OP 0.9.6-2 package, and extract OSG and OT directories to top level. Also download OSG_Win32_Dependencies-0.9.6-2.zip to get 3rdParty_2003-10-01 package. * Demeter 3.21 http://www.terrainengine.com/downloads.html Follow links to Sourceforge download page * wxWidgets 2.4.2 http://www.wxwidgets.org * OpenAL (Beta) CVS download instructions at http://www.openal.org/#Downloads * LibOGG 1.1 and LibVorbis 1.0.1 http://www.vorbis.com/download_win_1.0.1.psp libogg 1.1 source (listed as 1.0.1) libvorbis 1.0.1 source * Python 2.3.3 http://www.python.org/2.3.3/ Download Python-2.3.3.tgz --- Required libraries --- Library Nominal installation path ------------------ ----------------------- wxWidgets-2.4.2 C:\wxWindows-2.4.2 OpenSceneGraph-0.9.6-2 C:\OpenSceneGraph-0.9.6-2 OpenThreads-v1.2dev3-osg0.9.6 C:\OpenThreads-v1.2dev3-osg0.9.6 libxml and related C:\3rdParty_2003-10-01 Demeter 3.21 C:\demeter-3.21 OpenAL Beta C:\openal Lib OGG 1.1 C:\libogg-1.1 Lib Vorbis 1.0.1 C:\libvorbis-1.0.1 Python 2.3.3 C:\Python-2.3.3 Boost Python 1.31.0 C:\boost_1_31_0 --- Visual Studio Project Directories --- * Include files C:\3rdParty_2003-10-01\include C:\wxWindows-2.4.2\include C:\OpenSceneGraph-0.9.6-2\include C:\OpenThreads-v1.2dev3-osg0.9.6\include C:\openal\include C:\Python-2.3.3\include C:\boost_1_31_0 C:\demeter-3.21\include C:\libogg-1.1\include C:\libvorbis-1.0.1\include * Library files C:\3rdParty_2003-10-01\lib C:\OpenThreads-v1.2dev3-osg0.9.6\lib\win32 C:\wxWindows-2.4.1\lib C:\OpenSceneGraph-0.9.6-2\lib C:\openal\lib C:\Python-2.3.3\libs C:\boost_1_31_0\libs\python\build\bin-stage C:\demeter-3.21\lib C:\libogg-1.1\lib C:\libvorbis-1.0.1\libs * Source files (optional for debugging libraries) C:\wxWindows-2.4.1\src\msw C:\wxWindows-2.4.1\src C:\OpenSceneGraph-0.9.6-2\src C:\OpenThreads-v1.2dev3-osg0.9.6\win32_src C:\demeter-3.21\src * Project file conversion - Project files should be converted from VC6 to Visual Studio (.NET2003) format - To convert, open the .dsw file and select "Yes to All" when the convert dialog appears * Runtime libaries - All debug libraries must be built with the Multi-threaded Debug DLL runtime library (/MDd) - All release libraries must be built with the Multi-threaded DLL runtime library (/MD) * Build OpenThreads v1.2dev3-osg0.9.6 - Project file is at win32_src/OpenThreads.dsw directory * Build OSG (unload osgProducer and example projects, keep other osg projects and plugins) - Project file in VisualStudio directory - Preprocessor defs: Debug: _WINDOWS;SG_LIBRARY;WIN32;_DEBUG Release: WIN32;NDEBUG;_WINDOWS;_USRDLL;SG_LIBRARY - Unload examples and osgProducer projects * Build Demeter 3.21 - Project file in VisualStudio directory - Add #include <iostream> before "using namespace Demeter" statement in DemeterTextureLoader.cpp - Build Demeter, DemeterOSG, and DemeterTextureLoader projects * Python 2.3.3 - Option 1 (easiest): Use pre-built python23.lib included in .exe installer distribution - Option 2: Build it yourself from source distribution - Project file is at PCbuild/pcbuild.dsw - Enable RTTI - Build debug and release for pythoncore project - Use default preprocessor defs. They should be: Debug: _DEBUG;USE_DL_EXPORT;WIN32;_WINDOWS Release: NDEBUG;WIN32;_WINDOWS;USE_DL_EXPORT * Build Boost Python 1.31.0 - Project file is at libs/python/build/VisualStudio/boost_python.dsw - Debug preprocessor defs do not need to be modified if using the release python23.lib only Defs should be: _DEBUG;WIN32;_WINDOWS;_USRDLL;BOOST_PYTHON_DYNAMIC_LIB;BOOST_PYTHON_SOURCE To use the debug Python library add BOOST_PYTHON_DEBUG def. - Release preprocessor defs do not need to be modified. They should be these: NDEBUG;WIN32;_WINDOWS;_USRDLL;BOOST_PYTHON_DYNAMIC_LIB;BOOST_PYTHON_SOURCE - Produces warning C4244 * Build wxWidgets 2.4.2 (formerly known as wxWindows) - Project file is at src/wxWindows.dsw - In wxWindows project, open Headers/Setup/setup.h and change line 782 to read: #define wxUSE_GLCANVAS 1 - In include/wx/string.h add a line to suppress size_t conversion warning: #pragma warning(disable:4267) - Build Debug and Release configs for all projects in solution (do not build other configs like Debug DLL, Debug Unicode, etc.) - 1 warning, C4702 * Build OpenAL (Beta) - Project file is at win/OpenAL.dsw - Create a lib directory - Preprocessor defs: Debug: _DEBUG;WIN32;_WINDOWS;_USRDLL;_OPENAL32LIB Release: NDEBUG;WIN32;_WINDOWS;_USRDLL;_OPENAL32LIB - Build OpenAL32 (as DLL) and ALut (as static library) - Rename debug output to OpenAL32d.lib, OpenAL32d.dll, and ALutd.lib - Copy OpenAL32d.lib, OpenAL32.lib, ALut.lib, and ALutd.lib to lib directory. (or add post-build step to do this) * Build Lib OGG 1.1 - Project file is win32/ogg.dsw - Change runtime libary option to Multi-threaded Debug DLL for Debug config and Multi-threaded DLL for Release config. - Create a libogg-1.1/lib directory - Add Post-Build Event (under Build Events in Properties) for Debug configuration: copy Static_Debug\ogg_static_d.lib ..\lib\ogg_static_d.lib - Add Post-Build Event (under Build Events in Properties) for Release configuration: copy Static_Release\ogg_static.lib ..\lib\ogg_static.lib - Build the ogg_static project - Produces 15 warnings, C4244 and C4146 * Build Lib Vorbis 1.0.1 - Project file is win32/vorbis.dsw - Change runtime libary option to Multi-threaded Debug DLL for Debug config and Multi-threaded DLL for Release config. Do this for both vorbis_static and vorbisfile_static projects. - Create a libvorbis-1.0.1/libs directory - Add Post-Build Event for Debug config of vorbis_static: copy Vorbis_Static_Debug\vorbis_static_d.lib ..\libs\vorbis_static_d.lib - Add Post-Build Event for Release config of vorbis_static: copy Vorbis_Static_Release\vorbis_static.lib ..\libs\vorbis_static.lib - Add Post-Build Event for Release config of vorbisfile_static: copy VorbisFile_Static_Release\vorbisfile_static.lib ..\libs\vorbisfile_static.lib - Add Post-Build Event for Debug config of vorbisfile_static: copy VorbisFile_Static_Debug\vorbisfile_static_d.lib ..\libs\vorbisfile_static_d.lib - Build the vorbis_static and vorbisfile_static projects - vorbis_static: 147 warnings debug, 151 warnings release - vorbisfile_static: 11 warnings debug, 15 warnings release --- NEW FILE: CHANGES.txt --- CHANGES 0.6 --------------------------------------------------------------------- *** 2004-03-20 Dewitt Colclough *** - Merged 2D surface creation code into tcWindow class. This makes creating new windows a little easier. *** 2004-03-12 Dewitt Colclough *** - Added option to disable sound to help isolate sound-related crashes *** 2004-03-06 Dewitt Colclough *** - Updated project files and dependency package for VC .NET 2003 *** 2004-Various Dewitt Colclough *** - Added simple rotational animations to models - Added simple level of detail for 3D models. - Upgraded drag model for aircraft. Induced drag is now proportional to the square of the lift coefficient. - Engine thrust and fuel consumption (non-afterburner) for aircraft now decrease with altitude. 0.5.1 --------------------------------------------------------------------- - Reduced number of block artifacts visible when switching screens - Fixed popup menu location bug - 3D terrain loading is now skipped when 3D display is turned off (F4 key). There should be no delay when changing hooked units with 3D off now. - Fixed map scrolling bug. Symbols and map grid would appear in wrong locations when scrolling in some situations. - Fixed briefing mode map symbol location bug. Symbols were appearing at the wrong location when the briefing screen was displayed. After the briefing mode was exited, the bad locations would remain until the map view was changed. - Added more debug info to help isolate crash issues. |
|
From: Dewitt C. <ddc...@us...> - 2004-03-20 18:56:45
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4103/include/common Modified Files: tcOptionsView.h Log Message: Moved 2D surface creation code into tcWindow. Created docs folder Index: tcOptionsView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOptionsView.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcOptionsView.h 29 Feb 2004 22:51:35 -0000 1.4 --- tcOptionsView.h 20 Mar 2004 18:46:45 -0000 1.5 *************** *** 54,58 **** tcOptionsView(wxWindow *parent, const wxPoint& pos, const wxSize& size, ! const wxString& name = "OptionsView"); virtual ~tcOptionsView(); private: --- 54,59 ---- tcOptionsView(wxWindow *parent, const wxPoint& pos, const wxSize& size, ! const wxString& name = "OptionsView", ! tcWindow *sharedSurface = NULL); virtual ~tcOptionsView(); private: |
|
From: Dewitt C. <ddc...@us...> - 2004-03-20 18:55:43
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3904/xml Log Message: Directory /cvsroot/gcblue/gcb_wx/xml added to the repository |
|
From: Dewitt C. <ddc...@us...> - 2004-03-20 18:54:54
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3733/docs Log Message: Directory /cvsroot/gcblue/gcb_wx/docs added to the repository |
|
From: Dewitt C. <ddc...@us...> - 2004-03-20 13:54:50
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9117 Modified Files: BUILDING.txt Log Message: Index: BUILDING.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/BUILDING.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BUILDING.txt 8 Mar 2004 21:49:01 -0000 1.2 --- BUILDING.txt 20 Mar 2004 13:44:48 -0000 1.3 *************** *** 52,57 **** C:\OpenThreads-v1.2dev3-osg0.9.6\include C:\openal\include ! C:\Python-2.3.3\PC ! C:\Python-2.3.3\Include C:\boost_1_31_0 C:\demeter-3.21\include --- 52,56 ---- C:\OpenThreads-v1.2dev3-osg0.9.6\include C:\openal\include ! C:\Python-2.3.3\include C:\boost_1_31_0 C:\demeter-3.21\include *************** *** 66,70 **** C:\OpenSceneGraph-0.9.6-2\lib C:\openal\lib ! C:\Python-2.3.3\PCbuild C:\boost_1_31_0\libs\python\build\bin-stage C:\demeter-3.21\lib --- 65,69 ---- C:\OpenSceneGraph-0.9.6-2\lib C:\openal\lib ! C:\Python-2.3.3\libs C:\boost_1_31_0\libs\python\build\bin-stage C:\demeter-3.21\lib *************** *** 120,134 **** ! * Build Python 2.3.3 ! - Project file is at PCbuild/pcbuild.dsw ! - Enable RTTI ! - Build debug and release for pythoncore project ! - Use default preprocessor defs. They should be: ! Debug: _DEBUG;USE_DL_EXPORT;WIN32;_WINDOWS ! Release: NDEBUG;WIN32;_WINDOWS;USE_DL_EXPORT --- 119,137 ---- ! * Python 2.3.3 ! - Option 1 (easiest): Use pre-built python23.lib included in .exe installer distribution ! - Option 2: Build it yourself from source distribution ! - Project file is at PCbuild/pcbuild.dsw ! - Enable RTTI ! ! - Build debug and release for pythoncore project ! ! - Use default preprocessor defs. They should be: ! Debug: _DEBUG;USE_DL_EXPORT;WIN32;_WINDOWS ! Release: NDEBUG;WIN32;_WINDOWS;USE_DL_EXPORT |
|
From: <ddc...@us...> - 2004-03-08 22:05:42
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30492 Modified Files: BUILDING.txt Log Message: Index: BUILDING.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/BUILDING.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BUILDING.txt 26 Nov 2003 20:39:14 -0000 1.1 --- BUILDING.txt 8 Mar 2004 21:49:01 -0000 1.2 *************** *** 1,46 **** ! List of dependencies: ! ! wxWindows 2.4.1 ! OpenSceneGraph 0.9.5 (OpenGL 3D graphics engine) ! Producer (used by OpenSceneGraph for scene/camera management) ! OpenThreads (used by Producer for multithreaded cameras) ! OpenAL (replacement for DirectSound) ! Vorbis Ogg libraries (streaming music--build with Multithreaded DLL runtime libraries) ! Python 2.3.2 (embedded scripting engine) ! Boost Python 1.30.2 (C++ interface to Python. one file modified to build with Python 2.3. The CVS version of Boost Python may build without the mods) ! TODO provide links for download ! TODO provide info on auxiliary libraries like zlib, jpeg, etc that go with wxWindows and OSG ! ! Paths for these libraries should be added to the IDE with Options->Projects->VC++ Directories ! ! Below is a summary of example paths for libraries installed in C:\ ! ! ---Include paths--- ! ! C:\Producer\include ! C:\OpenThreads\include ! C:\wxWindows-2.4.1\include ! C:\wxWindows-2.4.1\include\wx\msw ! C:\OpenSceneGraph-0.9.5\include C:\openal\include ! C:\Python-2.3.2\PC ! C:\Python-2.3.2\Include ! C:\boost-1.30.2 ! C:\libogg-1.0\include ! C:\libvorbis-1.0\include ! ! ---Libraries--- ! ! C:\Producer\lib ! C:\OpenThreads\lib C:\wxWindows-2.4.1\lib ! C:\OpenSceneGraph-0.9.5\lib C:\openal\lib ! C:\Python-2.3.2\PCbuild ! C:\boost-1.30.2\libs\python\build\bin-stage ! C:\demeter\lib ! C:\libogg-1.0\lib ! C:\libvorbis-1.0\libs (created this directory and moved vorbis libraries into it) ! The DLLs for these libraries should be copied into the bin/ directory. --- 1,241 ---- ! --- Download information --- ! * OpenSceneGraph 0.9.6-2 and OpenThreads-v1.2dev3 ! http://openscenegraph.sourceforge.net/downloads/index.html ! Follow links to Sourceforge download page. ! Download bundled OSG_OT_OP 0.9.6-2 package, and extract OSG and OT directories ! to top level. ! Also download OSG_Win32_Dependencies-0.9.6-2.zip to get 3rdParty_2003-10-01 package. ! ! ! * Demeter 3.21 ! http://www.terrainengine.com/downloads.html ! Follow links to Sourceforge download page ! ! * wxWidgets 2.4.2 ! http://www.wxwidgets.org ! ! * OpenAL (Beta) ! CVS download instructions at http://www.openal.org/#Downloads ! ! * LibOGG 1.1 and LibVorbis 1.0.1 ! http://www.vorbis.com/download_win_1.0.1.psp ! libogg 1.1 source (listed as 1.0.1) ! libvorbis 1.0.1 source ! ! * Python 2.3.3 ! http://www.python.org/2.3.3/ ! Download Python-2.3.3.tgz ! ! --- Required libraries --- ! ! Library Nominal installation path ! ------------------ ----------------------- ! wxWidgets-2.4.2 C:\wxWindows-2.4.2 ! OpenSceneGraph-0.9.6-2 C:\OpenSceneGraph-0.9.6-2 ! OpenThreads-v1.2dev3-osg0.9.6 C:\OpenThreads-v1.2dev3-osg0.9.6 ! libxml and related C:\3rdParty_2003-10-01 ! Demeter 3.21 C:\demeter-3.21 ! OpenAL Beta C:\openal ! Lib OGG 1.1 C:\libogg-1.1 ! Lib Vorbis 1.0.1 C:\libvorbis-1.0.1 ! Python 2.3.3 C:\Python-2.3.3 ! Boost Python 1.31.0 C:\boost_1_31_0 ! ! --- Visual Studio Project Directories --- ! ! * Include files ! ! C:\3rdParty_2003-10-01\include ! C:\wxWindows-2.4.2\include ! C:\OpenSceneGraph-0.9.6-2\include ! C:\OpenThreads-v1.2dev3-osg0.9.6\include C:\openal\include ! C:\Python-2.3.3\PC ! C:\Python-2.3.3\Include ! C:\boost_1_31_0 ! C:\demeter-3.21\include ! C:\libogg-1.1\include ! C:\libvorbis-1.0.1\include ! ! * Library files ! ! C:\3rdParty_2003-10-01\lib ! C:\OpenThreads-v1.2dev3-osg0.9.6\lib\win32 C:\wxWindows-2.4.1\lib ! C:\OpenSceneGraph-0.9.6-2\lib C:\openal\lib ! C:\Python-2.3.3\PCbuild ! C:\boost_1_31_0\libs\python\build\bin-stage ! C:\demeter-3.21\lib ! C:\libogg-1.1\lib ! C:\libvorbis-1.0.1\libs ! ! * Source files (optional for debugging libraries) ! ! C:\wxWindows-2.4.1\src\msw ! C:\wxWindows-2.4.1\src ! C:\OpenSceneGraph-0.9.6-2\src ! C:\OpenThreads-v1.2dev3-osg0.9.6\win32_src ! C:\demeter-3.21\src ! ! * Project file conversion ! - Project files should be converted from VC6 to Visual Studio (.NET2003) format ! - To convert, open the .dsw file and select "Yes to All" when the convert dialog appears ! ! * Runtime libaries ! - All debug libraries must be built with the Multi-threaded Debug DLL runtime library (/MDd) ! - All release libraries must be built with the Multi-threaded DLL runtime library (/MD) ! ! ! ! ! * Build OpenThreads v1.2dev3-osg0.9.6 ! ! - Project file is at win32_src/OpenThreads.dsw directory ! ! ! ! * Build OSG (unload osgProducer and example projects, keep other osg projects and plugins) ! ! - Project file in VisualStudio directory ! ! - Preprocessor defs: ! Debug: _WINDOWS;SG_LIBRARY;WIN32;_DEBUG ! Release: WIN32;NDEBUG;_WINDOWS;_USRDLL;SG_LIBRARY ! ! - Unload examples and osgProducer projects ! ! ! ! * Build Demeter 3.21 ! ! - Project file in VisualStudio directory ! ! - Add #include <iostream> before "using namespace Demeter" statement in DemeterTextureLoader.cpp ! ! - Build Demeter, DemeterOSG, and DemeterTextureLoader projects ! ! ! ! ! * Build Python 2.3.3 ! ! - Project file is at PCbuild/pcbuild.dsw ! ! - Enable RTTI ! ! - Build debug and release for pythoncore project ! ! - Use default preprocessor defs. They should be: ! Debug: _DEBUG;USE_DL_EXPORT;WIN32;_WINDOWS ! Release: NDEBUG;WIN32;_WINDOWS;USE_DL_EXPORT ! ! ! ! ! * Build Boost Python 1.31.0 ! ! - Project file is at libs/python/build/VisualStudio/boost_python.dsw ! ! - Debug preprocessor defs do not need to be modified if using the release python23.lib only ! Defs should be: ! _DEBUG;WIN32;_WINDOWS;_USRDLL;BOOST_PYTHON_DYNAMIC_LIB;BOOST_PYTHON_SOURCE ! To use the debug Python library add BOOST_PYTHON_DEBUG def. ! ! - Release preprocessor defs do not need to be modified. They should be these: ! NDEBUG;WIN32;_WINDOWS;_USRDLL;BOOST_PYTHON_DYNAMIC_LIB;BOOST_PYTHON_SOURCE ! ! - Produces warning C4244 ! ! ! ! ! ! * Build wxWidgets 2.4.2 (formerly known as wxWindows) ! ! - Project file is at src/wxWindows.dsw ! ! - In wxWindows project, open Headers/Setup/setup.h and change line 782 to read: ! #define wxUSE_GLCANVAS 1 ! ! - In include/wx/string.h add a line to suppress size_t conversion warning: ! #pragma warning(disable:4267) ! ! - Build Debug and Release configs for all projects in solution ! (do not build other configs like Debug DLL, Debug Unicode, etc.) ! - 1 warning, C4702 ! ! ! * Build OpenAL (Beta) ! ! - Project file is at win/OpenAL.dsw ! ! - Create a lib directory ! ! - Preprocessor defs: ! Debug: _DEBUG;WIN32;_WINDOWS;_USRDLL;_OPENAL32LIB ! Release: NDEBUG;WIN32;_WINDOWS;_USRDLL;_OPENAL32LIB ! ! - Build OpenAL32 (as DLL) and ALut (as static library) ! ! - Rename debug output to OpenAL32d.lib, OpenAL32d.dll, and ALutd.lib ! ! - Copy OpenAL32d.lib, OpenAL32.lib, ALut.lib, and ALutd.lib to lib directory. ! (or add post-build step to do this) ! ! ! ! ! ! * Build Lib OGG 1.1 ! ! - Project file is win32/ogg.dsw ! ! - Change runtime libary option to Multi-threaded Debug DLL for Debug config and ! Multi-threaded DLL for Release config. ! ! - Create a libogg-1.1/lib directory ! ! - Add Post-Build Event (under Build Events in Properties) for Debug configuration: ! copy Static_Debug\ogg_static_d.lib ..\lib\ogg_static_d.lib ! ! - Add Post-Build Event (under Build Events in Properties) for Release configuration: ! copy Static_Release\ogg_static.lib ..\lib\ogg_static.lib ! ! - Build the ogg_static project ! ! - Produces 15 warnings, C4244 and C4146 ! ! ! ! ! * Build Lib Vorbis 1.0.1 ! ! - Project file is win32/vorbis.dsw ! ! - Change runtime libary option to Multi-threaded Debug DLL for Debug config and ! Multi-threaded DLL for Release config. Do this for both vorbis_static and ! vorbisfile_static projects. ! ! - Create a libvorbis-1.0.1/libs directory ! ! - Add Post-Build Event for Debug config of vorbis_static: ! copy Vorbis_Static_Debug\vorbis_static_d.lib ..\libs\vorbis_static_d.lib ! ! - Add Post-Build Event for Release config of vorbis_static: ! copy Vorbis_Static_Release\vorbis_static.lib ..\libs\vorbis_static.lib ! ! - Add Post-Build Event for Release config of vorbisfile_static: ! copy VorbisFile_Static_Release\vorbisfile_static.lib ..\libs\vorbisfile_static.lib ! ! - Add Post-Build Event for Debug config of vorbisfile_static: ! copy VorbisFile_Static_Debug\vorbisfile_static_d.lib ..\libs\vorbisfile_static_d.lib ! ! - Build the vorbis_static and vorbisfile_static projects ! ! - vorbis_static: 147 warnings debug, 151 warnings release ! ! - vorbisfile_static: 11 warnings debug, 15 warnings release ! |
|
From: <ddc...@us...> - 2004-03-06 21:07:38
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9771/include/network Modified Files: tcConnectionData.h tcMessage.h tcMultiplayerInterface.h tcNetworkInterface.h Log Message: Index: tcConnectionData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcConnectionData.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcConnectionData.h 2 Mar 2004 02:52:14 -0000 1.2 --- tcConnectionData.h 6 Mar 2004 20:52:29 -0000 1.3 *************** *** 55,66 **** ! void ReadNextMessage(); void SendTCP(unsigned int idx); void Update(); ///< read and write data from socket ! void WriteQueuedMessage(); tcConnectionData(); private: tcMessage tempMessage; ///< message to use for temporary storage }; --- 55,71 ---- ! void ReadNextMessageTCP(); ! void ReadNextMessageUDP(unsigned int messageSize, unsigned char *buffer); void SendTCP(unsigned int idx); + void SendUDP(unsigned int idx, bool useAck = false); void Update(); ///< read and write data from socket ! void WriteQueuedMessages(); tcConnectionData(); private: tcMessage tempMessage; ///< message to use for temporary storage + + void WriteTCP(); + void WriteUDP(); }; Index: tcMessage.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMessage.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcMessage.h 2 Mar 2004 02:52:14 -0000 1.2 --- tcMessage.h 6 Mar 2004 20:52:29 -0000 1.3 *************** *** 36,49 **** enum { ! BUFFER_SIZE = 1024, }; - int id; ///< id of message - int sourceId; ///< connection id of source of message unsigned int timestamp; unsigned short bufferIdx; ! unsigned short messageSize; ///< size of data portion of message in bytes ! unsigned char buffer[BUFFER_SIZE]; void Reset(); tcMessage(); tcMessage(const tcMessage& source); --- 36,67 ---- enum { ! BUFFER_SIZE = 1024, /// < max size in bytes of total message including header ! HEADER_SIZE = 8, ! SIZE_SIZE = 2, ///< size of messageSize field (first field in header) ! MESSAGE_SIZE = BUFFER_SIZE - HEADER_SIZE, }; unsigned int timestamp; unsigned short bufferIdx; ! union DATA_UNION ! { ! struct HEADER ! { ! unsigned int messageSize : 16; ///< size of message in bytes (including all header fields) ! int sourceId : 16; ///< connection id of source of message ! unsigned int : 0; ! int id : 32; ///< id of message ! } header; ! unsigned char buffer[BUFFER_SIZE]; ! } data; + const unsigned char* GetMessageData(); + int GetMessageId(); + unsigned int GetMessageSize(); + unsigned int GetMessageTimestamp(); + void PopulateMessage(int sourceId, int messageId, unsigned messageSize, + const unsigned char *messageData); void Reset(); + void StampTime(); + tcMessage(); tcMessage(const tcMessage& source); Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcMultiplayerInterface.h 2 Mar 2004 02:52:14 -0000 1.2 --- tcMultiplayerInterface.h 6 Mar 2004 20:52:29 -0000 1.3 *************** *** 41,44 **** --- 41,52 ---- class tcNetworkInterface; + + class tcPlayerStatus + { + public: + std::string name; ///< handle for player + unsigned timestamp; ///< time of last update + }; + /** * Singleton multiplayer interface class to manage connections, *************** *** 55,58 **** --- 63,67 ---- { MSG_CHATTEXT = 1, + MSG_USERNAME = 2, }; static tcMultiplayerInterface& Get(); *************** *** 65,73 **** bool IsChatTextAvail(); ! void MakeClient(); void MakeServer(); void OpenConnection(std::string hostName); void SendChatText(int destination, std::string message); void Update(); --- 74,84 ---- bool IsChatTextAvail(); ! bool IsServer(); void MakeClient(); void MakeServer(); void OpenConnection(std::string hostName); void SendChatText(int destination, std::string message); + void SendTestUDP(int destination, std::string message); + void SetChatProtocol(int code); void Update(); *************** *** 75,82 **** tcNetworkInterface *networkInterface; std::queue<std::string> chatText; ///< chat text to display void ProcessMessage(int connectionId, int messageId, ! unsigned messageSize, unsigned char *data); void ProcessReceiveMessages(); tcMultiplayerInterface(); tcMultiplayerInterface(const tcMultiplayerInterface& source); --- 86,99 ---- tcNetworkInterface *networkInterface; std::queue<std::string> chatText; ///< chat text to display + std::string myName; + std::map<int, tcPlayerStatus> playerInfo; ///< map of (connection id, tcPlayerStatus) pairs + bool tcpChat; ///< true to use TCP for chat protocol, otherwise UDP + bool IsNewPlayer(int id); void ProcessMessage(int connectionId, int messageId, ! unsigned messageSize, const unsigned char *data); void ProcessReceiveMessages(); + void UpdatePlayerInfo(); + tcMultiplayerInterface(); tcMultiplayerInterface(const tcMultiplayerInterface& source); Index: tcNetworkInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcNetworkInterface.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcNetworkInterface.h 2 Mar 2004 02:52:14 -0000 1.5 --- tcNetworkInterface.h 6 Mar 2004 20:52:29 -0000 1.6 *************** *** 31,34 **** --- 31,35 ---- #include <queue> #include <map> + #include <string> #include "tcConnectionData.h" #include "tcMessage.h" *************** *** 51,54 **** --- 52,57 ---- UDP_PORT = 3011, MESSAGE_BUFFER_SIZE = 128, + UDP_EVENT_ID = -123, + MAX_UDP_SIZE = 4096, }; *************** *** 63,67 **** void OpenConnection(wxString hostName); ! unsigned char* ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol = TCP); bool SendMessage(int connectionId, int messageId, unsigned messageSize, --- 66,70 ---- void OpenConnection(wxString hostName); ! const unsigned char* ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol = TCP); bool SendMessage(int connectionId, int messageId, unsigned messageSize, *************** *** 88,95 **** wxSocketClient *clientSock; ///< single socket that will be used in client mode wxSocketServer *serverSock; ///< server socket for server mode std::vector<tcConnectionData> connectionData; ///< vector of connection data std::vector<tcMessage> messageBuffer; std::queue<unsigned int> available; ///< fifo of free slot indices ! std::map<int, int> connectionLookup; ///< connection id key, connectionData idx (-1 invalid) void AddConnection(wxSocketBase *socket); // adds socket to connectionData --- 91,101 ---- wxSocketClient *clientSock; ///< single socket that will be used in client mode wxSocketServer *serverSock; ///< server socket for server mode + wxDatagramSocket *datagramSock; ///< UDP socket + std::vector<tcConnectionData> connectionData; ///< vector of connection data std::vector<tcMessage> messageBuffer; std::queue<unsigned int> available; ///< fifo of free slot indices ! std::map<int, int> connectionLookup; ///< (connection id key, connectionData idx (-1 invalid)) ! std::map<std::string, int> peerMap; ///< another lookup (peername, connectionData idx) void AddConnection(wxSocketBase *socket); // adds socket to connectionData *************** *** 98,101 **** --- 104,110 ---- int CheckoutMessage(); tcConnectionData* GetConnection(int idx); + tcConnectionData* GetConnection(std::string peerName); + wxDatagramSocket* GetDatagramSocket() {return datagramSock;} + void InitializeUDP(); int LookupConnectionIndex(int id); void OnSocketEvent(wxSocketEvent& event); *************** *** 104,107 **** --- 113,117 ---- void ReturnMessage(unsigned int idx); void ReturnMessagesFromQueue(std::queue<unsigned int>& q); + void RouteUDP(); void UpdateClient(); void UpdateClientConnection(); |
|
From: <ddc...@us...> - 2004-03-06 21:07:38
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9771 Modified Files: GCblue.sln GCblue.vcproj Log Message: Index: GCblue.sln =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.sln,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GCblue.sln 27 Sep 2003 23:22:24 -0000 1.1 --- GCblue.sln 6 Mar 2004 20:52:28 -0000 1.2 *************** *** 1,11 **** ! Microsoft Visual Studio Solution File, Format Version 7.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GCblue", "GCblue.vcproj", "{76C3883D-96DD-4A32-91C5-2ADA4CA505E7}" EndProject Global GlobalSection(SolutionConfiguration) = preSolution ! ConfigName.0 = Debug ! ConfigName.1 = Release ! EndGlobalSection ! GlobalSection(ProjectDependencies) = postSolution EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution --- 1,11 ---- ! Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GCblue", "GCblue.vcproj", "{76C3883D-96DD-4A32-91C5-2ADA4CA505E7}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution ! Debug = Debug ! Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** GCblue.vcproj 2 Mar 2004 02:52:13 -0000 1.45 --- GCblue.vcproj 6 Mar 2004 20:52:28 -0000 1.46 *************** *** 1,6 **** ! <?xml version="1.0" encoding = "Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" ! Version="7.00" Name="GCblue" ProjectGUID="{76C3883D-96DD-4A32-91C5-2ADA4CA505E7}" --- 1,6 ---- ! <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" ! Version="7.10" Name="GCblue" ProjectGUID="{76C3883D-96DD-4A32-91C5-2ADA4CA505E7}" *************** *** 23,27 **** Optimization="0" AdditionalIncludeDirectories="include/sim;include/graphics;include/common;include/scriptinterface;include;"C:\wxWindows-2.4.1\lib\mswd";include\database" ! PreprocessorDefinitions="WIN32;_DEBUG;BOOST_DEBUG_PYTHON;_WINDOWS;__WINDOWS__;__WXMSW__;__WXDEBUG__;WXDEBUG=1;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;_WIN32_IMPLEMENTATION" MinimalRebuild="FALSE" BasicRuntimeChecks="3" --- 23,27 ---- Optimization="0" AdditionalIncludeDirectories="include/sim;include/graphics;include/common;include/scriptinterface;include;"C:\wxWindows-2.4.1\lib\mswd";include\database" ! PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;__WXDEBUG__;WXDEBUG=1;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;_WIN32_IMPLEMENTATION" MinimalRebuild="FALSE" BasicRuntimeChecks="3" *************** *** 39,48 **** Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23_d.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 pngd.lib zlibd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib libxml2.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" LinkIncremental="2" AdditionalLibraryDirectories="" ! IgnoreDefaultLibraryNames="libcd.lib;libcid.lib;msvcrt.lib;python23.lib" DelayLoadDLLs="" GenerateDebugInformation="TRUE" --- 39,48 ---- 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 osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib libxml2.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" LinkIncremental="2" AdditionalLibraryDirectories="" ! IgnoreDefaultLibraryNames="libcd.lib;libcid.lib;msvcrt.lib" DelayLoadDLLs="" GenerateDebugInformation="TRUE" *************** *** 65,69 **** --- 65,75 ---- Name="VCWebServiceProxyGeneratorTool"/> <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration *************** *** 124,130 **** --- 130,144 ---- Name="VCWebServiceProxyGeneratorTool"/> <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> + <References> + </References> <Files> <Filter *************** *** 193,199 **** Filter=""> <File - RelativePath="src\graphics\ObjectUpdater.cpp"> - </File> - <File RelativePath="src\graphics\cspColorspace.cpp"> </File> --- 207,210 ---- *************** *** 211,214 **** --- 222,228 ---- </File> <File + RelativePath="src\graphics\ObjectUpdater.cpp"> + </File> + <File RelativePath="src\graphics\tc2DGraphicsSurface.cpp"> </File> *************** *** 297,303 **** </File> <File - RelativePath="src\sim\tcAIData.cpp"> - </File> - <File RelativePath="src\sim\tcAero.cpp"> </File> --- 311,314 ---- *************** *** 306,309 **** --- 317,323 ---- </File> <File + RelativePath="src\sim\tcAIData.cpp"> + </File> + <File RelativePath="src\sim\tcAirObject.cpp"> </File> *************** *** 324,330 **** </File> <File - RelativePath="src\sim\tcESMSensor.cpp"> - </File> - <File RelativePath="src\sim\tcEditControl.cpp"> </File> --- 338,341 ---- *************** *** 333,340 **** </File> <File ! RelativePath="src\sim\tcFlightPort.cpp"> </File> <File ! RelativePath="src\sim\tcGameObjIterator.cpp"> </File> <File --- 344,351 ---- </File> <File ! RelativePath="src\sim\tcESMSensor.cpp"> </File> <File ! RelativePath="src\sim\tcFlightPort.cpp"> </File> <File *************** *** 342,345 **** --- 353,359 ---- </File> <File + RelativePath="src\sim\tcGameObjIterator.cpp"> + </File> + <File RelativePath="src\sim\tcGameView.cpp"> </File> *************** *** 357,364 **** </File> <File ! RelativePath="src\sim\tcLaunchRequest.cpp"> </File> <File ! RelativePath="src\sim\tcLauncherState.cpp"> </File> <File --- 371,378 ---- </File> <File ! RelativePath="src\sim\tcLauncherState.cpp"> </File> <File ! RelativePath="src\sim\tcLaunchRequest.cpp"> </File> <File *************** *** 378,385 **** </File> <File ! RelativePath="src\sim\tcOOBView.cpp"> </File> <File ! RelativePath="src\sim\tcObjectControl.cpp"> </File> <File --- 392,399 ---- </File> <File ! RelativePath="src\sim\tcObjectControl.cpp"> </File> <File ! RelativePath="src\sim\tcOOBView.cpp"> </File> <File *************** *** 436,442 **** </File> <File - RelativePath="src\database\tcDBString.cpp"> - </File> - <File RelativePath="src\database\tcDatabase.cpp"> </File> --- 450,453 ---- *************** *** 445,448 **** --- 456,462 ---- </File> <File + RelativePath="src\database\tcDBString.cpp"> + </File> + <File RelativePath="src\database\tcESMDBObject.cpp"> </File> *************** *** 499,505 **** </File> <File - RelativePath="include\common\Resource.h"> - </File> - <File RelativePath="include\common\cspDate.h"> </File> --- 513,516 ---- *************** *** 514,517 **** --- 525,531 ---- </File> <File + RelativePath="include\common\Resource.h"> + </File> + <File RelativePath="include\common\simmath.h"> </File> *************** *** 554,560 **** Filter=""> <File - RelativePath="include\graphics\ObjectUpdater.h"> - </File> - <File RelativePath="include\graphics\cspColorspace.h"> </File> --- 568,571 ---- *************** *** 566,569 **** --- 577,583 ---- </File> <File + RelativePath="include\graphics\ObjectUpdater.h"> + </File> + <File RelativePath="include\graphics\tc2DGraphicsSurface.h"> </File> *************** *** 637,644 **** Filter=""> <File ! RelativePath="include\sim\Game.h"> </File> <File ! RelativePath="include\sim\commandlist.h"> </File> <File --- 651,658 ---- Filter=""> <File ! RelativePath="include\sim\commandlist.h"> </File> <File ! RelativePath="include\sim\Game.h"> </File> <File *************** *** 652,658 **** </File> <File - RelativePath="include\sim\tcAIData.h"> - </File> - <File RelativePath="include\sim\tcAero.h"> </File> --- 666,669 ---- *************** *** 661,664 **** --- 672,678 ---- </File> <File + RelativePath="include\sim\tcAIData.h"> + </File> + <File RelativePath="include\sim\tcAirObject.h"> </File> *************** *** 679,685 **** </File> <File - RelativePath="include\sim\tcESMSensor.h"> - </File> - <File RelativePath="include\sim\tcEditControl.h"> </File> --- 693,696 ---- *************** *** 688,695 **** </File> <File ! RelativePath="include\sim\tcFlightPort.h"> </File> <File ! RelativePath="include\sim\tcGameObjIterator.h"> </File> <File --- 699,706 ---- </File> <File ! RelativePath="include\sim\tcESMSensor.h"> </File> <File ! RelativePath="include\sim\tcFlightPort.h"> </File> <File *************** *** 697,700 **** --- 708,714 ---- </File> <File + RelativePath="include\sim\tcGameObjIterator.h"> + </File> + <File RelativePath="include\sim\tcGameView.h"> </File> *************** *** 712,719 **** </File> <File ! RelativePath="include\sim\tcLaunchRequest.h"> </File> <File ! RelativePath="include\sim\tcLauncherState.h"> </File> <File --- 726,733 ---- </File> <File ! RelativePath="include\sim\tcLauncherState.h"> </File> <File ! RelativePath="include\sim\tcLaunchRequest.h"> </File> <File *************** *** 733,740 **** </File> <File ! RelativePath="include\sim\tcOOBView.h"> </File> <File ! RelativePath="include\sim\tcObjectControl.h"> </File> <File --- 747,754 ---- </File> <File ! RelativePath="include\sim\tcObjectControl.h"> </File> <File ! RelativePath="include\sim\tcOOBView.h"> </File> <File *************** *** 797,810 **** </File> <File ! RelativePath="include\database\tcDBObjSerializer.h"> </File> <File ! RelativePath="include\database\tcDBString.h"> </File> <File ! RelativePath="include\database\tcDatabase.h"> </File> <File ! RelativePath="include\database\tcDatabaseObject.h"> </File> <File --- 811,824 ---- </File> <File ! RelativePath="include\database\tcDatabase.h"> </File> <File ! RelativePath="include\database\tcDatabaseObject.h"> </File> <File ! RelativePath="include\database\tcDBObjSerializer.h"> </File> <File ! RelativePath="include\database\tcDBString.h"> </File> <File *************** *** 854,866 **** Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> <File - RelativePath="res\Default.wav"> - </File> - <File - RelativePath="res\GCblue.ico"> - </File> - <File - RelativePath="res\GCblue.rc"> - </File> - <File RelativePath="res\wx\msw\blank.cur"> </File> --- 868,871 ---- *************** *** 881,884 **** --- 886,892 ---- </File> <File + RelativePath="res\Default.wav"> + </File> + <File RelativePath="res\wx\msw\disable.bmp"> </File> *************** *** 899,902 **** --- 907,916 ---- </File> <File + RelativePath="res\GCblue.ico"> + </File> + <File + RelativePath="res\GCblue.rc"> + </File> + <File RelativePath="res\wx\msw\hand.cur"> </File> *************** *** 948,951 **** --- 962,968 ---- </File> <File + RelativePath="wav\consolebeep.wav"> + </File> + <File RelativePath="wav\Explosion.wav"> </File> *************** *** 981,984 **** --- 998,1004 ---- </File> <File + RelativePath="wav\radarping.wav"> + </File> + <File RelativePath="wav\RejectBeep.wav"> </File> *************** *** 995,1004 **** RelativePath="wav\TwoBeeps.wav"> </File> - <File - RelativePath="wav\consolebeep.wav"> - </File> - <File - RelativePath="wav\radarping.wav"> - </File> </Filter> <Filter --- 1015,1018 ---- |
|
From: <ddc...@us...> - 2004-03-06 21:07:38
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9771/src/sim Modified Files: Game.cpp gcb.cpp tcNetworkView.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Game.cpp 2 Mar 2004 02:52:15 -0000 1.67 --- Game.cpp 6 Mar 2004 20:52:29 -0000 1.68 *************** *** 339,344 **** try { ! StartMusic(); ! std::cout << "Music start success" << std::endl; Initialize3DViewer(); --- 339,344 ---- try { ! InitializeSound(); ! std::cout << "InitializeSound() completed" << std::endl; Initialize3DViewer(); *************** *** 400,403 **** --- 400,408 ---- meScreenMode = START; + if (mcOptions.mbPlayMusic) + { + tcSound::Get()->PlayMusic("loop1"); + } + wxWindow::Show(TRUE); } *************** *** 434,440 **** /** ! * Initialize sound and start the music track. */ ! void tcGame::StartMusic() { if (mcOptions.disableSound) return; --- 439,445 ---- /** ! * Initialize sound */ ! void tcGame::InitializeSound() { if (mcOptions.disableSound) return; *************** *** 450,458 **** return; } - - if (mcOptions.mbPlayMusic) - { - tcSound::Get()->PlayMusic("loop1"); - } } --- 455,458 ---- Index: gcb.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/gcb.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** gcb.cpp 27 Feb 2004 00:07:59 -0000 1.13 --- gcb.cpp 6 Mar 2004 20:52:29 -0000 1.14 *************** *** 267,292 **** void GcbApp::InitializeGameFrame() { ! gameFrame = new tcGame(wxPoint(0,0), wxGetDisplaySize()); // full screen ! if (gameFrame == NULL) ! { ! wxMessageBox("Failed to create the game frame."); ! WTL("Failed to create the game frame."); ! throw exception(); ! } ! else ! { ! try ! { ! gameFrame->Init(); ! } ! catch(...) ! { ! wxMessageBox("The game frame failed to initialize."); ! WTL("The game frame failed to initialize."); - throw exception(); - } - } } \ No newline at end of file --- 267,291 ---- void GcbApp::InitializeGameFrame() { ! /* ! if (gameFrame == NULL) ! { ! wxMessageBox("Failed to create the game frame."); ! WTL("Failed to create the game frame."); ! throw exception(); ! } ! */ ! try ! { ! gameFrame = new tcGame(wxPoint(0,0), wxGetDisplaySize()); // full screen ! gameFrame->Init(); ! } ! catch(...) ! { ! wxMessageBox("The game frame failed to initialize."); ! WTL("The game frame failed to initialize."); ! throw exception(); ! } } \ No newline at end of file Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcNetworkView.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcNetworkView.cpp 2 Mar 2004 02:52:15 -0000 1.5 --- tcNetworkView.cpp 6 Mar 2004 20:52:29 -0000 1.6 *************** *** 41,45 **** EVT_COMMAND(ID_MULTIPLAYERMODE, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetNetworkMode) EVT_COMMAND(ID_CONNECT, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::OnConnect) ! EVT_COMMAND(ID_CHATTEXT, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SendChatText) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetIPText) EVT_COMMAND(2, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SendChatText) --- 41,46 ---- EVT_COMMAND(ID_MULTIPLAYERMODE, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetNetworkMode) EVT_COMMAND(ID_CONNECT, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::OnConnect) ! EVT_COMMAND(ID_SENDTEST, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SendTest) ! EVT_COMMAND(ID_CHATPROTOCOL, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetChatProtocol) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetIPText) EVT_COMMAND(2, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SendChatText) *************** *** 130,133 **** --- 131,148 ---- } + // if server, print chat text locally since no echo comes back + if (tcMultiplayerInterface::Get().IsServer()) + { + chatBox->Print(chatText.c_str()); + } + + } + + void tcNetworkView::SetChatProtocol(wxCommandEvent& event) + { + int protocol = event.m_extraLong; + + + tcMultiplayerInterface::Get().SetChatProtocol(protocol == 0); } *************** *** 159,162 **** --- 174,198 ---- } + void tcNetworkView::SendTest(wxCommandEvent& event) + { + std::string testText = "Test text for UDP"; + + unsigned nConnections = tcMultiplayerInterface::Get().GetNumConnections(); + + for (unsigned n=0;n<nConnections;n++) + { + int connId = tcMultiplayerInterface::Get().GetConnectionId(n); + tcMultiplayerInterface::Get().SendTestUDP(connId, testText); + } + + // if server, print chat text locally since no echo comes back + if (tcMultiplayerInterface::Get().IsServer()) + { + std::string localText = std::string("Sent UDP test: ") + + testText; + chatBox->Print(localText.c_str()); + } + } + /** * @param surfaceHost tcWindow to share surface of |
|
From: <ddc...@us...> - 2004-03-06 21:07:38
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9771/include/sim Modified Files: Game.h tcNetworkView.h Log Message: Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Game.h 29 Feb 2004 22:51:35 -0000 1.27 --- Game.h 6 Mar 2004 20:52:29 -0000 1.28 *************** *** 248,253 **** bool UpdateStart(); void Initialize3DViewer(); - void StartMusic(); - void InitializeBriefingConsoles(); void InitializeCreditView(); --- 248,251 ---- *************** *** 256,259 **** --- 254,258 ---- void InitializeOptionsView(); void InitializeScenarioSelectView(); + void InitializeSound(); void InitializeStartView(); void InitializeTacticalMap(); Index: tcNetworkView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcNetworkView.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcNetworkView.h 2 Mar 2004 02:52:14 -0000 1.4 --- tcNetworkView.h 6 Mar 2004 20:52:29 -0000 1.5 *************** *** 49,52 **** --- 49,54 ---- void OnLButtonDown(wxMouseEvent& event); void SendChatText(wxCommandEvent& event); + void SendTest(wxCommandEvent& event); + void SetChatProtocol(wxCommandEvent& event); void SetIPText(wxCommandEvent& event); void SetNetworkMode(wxCommandEvent& event); |
|
From: <ddc...@us...> - 2004-03-06 21:07:38
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9771/src/common Modified Files: tcSound.cpp Log Message: Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcSound.cpp 29 Feb 2004 22:51:35 -0000 1.13 --- tcSound.cpp 6 Mar 2004 20:52:29 -0000 1.14 *************** *** 103,106 **** --- 103,108 ---- LoadWavDataFromFile("jetlaunch.wav",SEFFECT_JETLAUNCH); LoadWavDataFromFile("MutedBeep.wav",SEFFECT_MUTEDBEEP); + LoadWavDataFromFile("intercom.wav",SEFFECT_INTERCOM); + LoadWavDataFromFile("fslide.wav",SEFFECT_FSLIDE); if((alGetError())!=AL_NO_ERROR) *************** *** 168,171 **** --- 170,178 ---- } + // add to effect map to lookup by name + wxString fileName(azFileName); + wxString nameRoot = fileName.BeforeFirst('.'); + effectMap[std::string(nameRoot.c_str())] = anEffectID; + return true; } *************** *** 430,433 **** --- 437,455 ---- + 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) { |
|
From: <ddc...@us...> - 2004-03-06 21:07:38
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9771/include/common Modified Files: tcSound.h wxcommands.h Log Message: Index: tcSound.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcSound.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcSound.h 29 Feb 2004 22:51:35 -0000 1.10 --- tcSound.h 6 Mar 2004 20:52:28 -0000 1.11 *************** *** 31,34 **** --- 31,35 ---- #include <AL/alc.h> #include <string> + #include <map> class tcOggStreamer; *************** *** 57,61 **** #define SEFFECT_JETLAUNCH 18 #define SEFFECT_MUTEDBEEP 19 ! #define N_SEFFECT 20 #define N_EFFECT_BUFFERS 16 --- 58,64 ---- #define SEFFECT_JETLAUNCH 18 #define SEFFECT_MUTEDBEEP 19 ! #define SEFFECT_INTERCOM 20 ! #define SEFFECT_FSLIDE 21 ! #define N_SEFFECT 22 #define N_EFFECT_BUFFERS 16 *************** *** 81,84 **** --- 84,88 ---- bool GetMusicPause() const; void PlayEffect(int anEffect); + void PlayEffect(std::string effectName); void PlayMusic(int anTrack); void PlayMusic(std::string song); *************** *** 102,105 **** --- 106,111 ---- ~tcSound(); + std::map<std::string, int> effectMap; + tcOggStreamer *oggStreamer; ///< class for streaming Ogg music struct _effectbuffinfo Index: wxcommands.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/wxcommands.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wxcommands.h 29 Feb 2004 22:51:35 -0000 1.11 --- wxcommands.h 6 Mar 2004 20:52:28 -0000 1.12 *************** *** 46,50 **** ID_MULTIPLAYERMODE = 150, ///< 0 - none, 1 - client, 2 - server ID_CONNECT = 160, ! ID_CHATTEXT = 170, }; --- 46,51 ---- ID_MULTIPLAYERMODE = 150, ///< 0 - none, 1 - client, 2 - server ID_CONNECT = 160, ! ID_SENDTEST = 170, ! ID_CHATPROTOCOL = 180, }; |
|
From: <ddc...@us...> - 2004-03-06 21:07:37
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9771/src/network Modified Files: tcConnectionData.cpp tcMessage.cpp tcMultiplayerInterface.cpp tcNetworkInterface.cpp Log Message: Index: tcConnectionData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcConnectionData.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcConnectionData.cpp 2 Mar 2004 02:52:14 -0000 1.2 --- tcConnectionData.cpp 6 Mar 2004 20:52:29 -0000 1.3 *************** *** 42,82 **** * the idx is stored in the appropriate receive queue. */ ! void tcConnectionData::ReadNextMessage() { wxASSERT(socket); ! // attempt to read header if header needs to be read ! if (tempMessage.id == -1) ! { ! const unsigned headerSize = sizeof(tempMessage.messageSize) + ! sizeof(tempMessage.id); ! ! // verify the message header and at least one byte of data are available ! socket->Read(tempMessage.buffer + tempMessage.bufferIdx, ! headerSize - tempMessage.bufferIdx); ! tempMessage.bufferIdx += socket->LastCount(); - - if (tempMessage.bufferIdx >= headerSize) - { - memcpy(&tempMessage.messageSize, tempMessage.buffer, sizeof(tempMessage.messageSize)); - memcpy(&tempMessage.id, tempMessage.buffer + sizeof(tempMessage.messageSize), - sizeof(tempMessage.id)); - tempMessage.bufferIdx = 0; - } } ! if (tempMessage.id == -1) { ! fprintf(stdout, " Read partial message: %d bytes of data\n", tempMessage.bufferIdx); return; } // Read message ! socket->Read(tempMessage.buffer + tempMessage.bufferIdx, ! tempMessage.messageSize - tempMessage.bufferIdx); tempMessage.bufferIdx += socket->LastCount(); ! if (tempMessage.bufferIdx >= tempMessage.messageSize) { } --- 42,69 ---- * the idx is stored in the appropriate receive queue. */ ! void tcConnectionData::ReadNextMessageTCP() { wxASSERT(socket); ! // read size field first ! if (tempMessage.bufferIdx == 0) ! { ! socket->Read(tempMessage.data.buffer, tcMessage::SIZE_SIZE); tempMessage.bufferIdx += socket->LastCount(); } ! if (tempMessage.bufferIdx == 0) { ! std::cerr << "Warning - tcConnectionData::ReadNextMessage() called with empty read buffer" ! << std::endl; return; } // Read message ! socket->Read(tempMessage.data.buffer + tempMessage.bufferIdx, ! tempMessage.data.header.messageSize - tempMessage.bufferIdx); tempMessage.bufferIdx += socket->LastCount(); ! if (tempMessage.bufferIdx >= tempMessage.data.header.messageSize) { } *************** *** 90,94 **** std::string testString; ! testString = (char*)tempMessage.buffer; /* --- 77,81 ---- std::string testString; ! testString = (const char*)tempMessage.GetMessageData(); /* *************** *** 107,114 **** *message = tempMessage; readQueueTCP.push(bufferIdx); fprintf(stdout, " Received message, size: %d, id:%d, t:%d data:%s\n", ! tempMessage.messageSize, tempMessage.id, tcTime::Get30HzCount(), testString.c_str()); tempMessage.Reset(); --- 94,104 ---- *message = tempMessage; + message->StampTime(); + readQueueTCP.push(bufferIdx); fprintf(stdout, " Received message, size: %d, id:%d, t:%d data:%s\n", ! message->GetMessageSize(), message->GetMessageId(), ! message->GetMessageTimestamp(), testString.c_str()); tempMessage.Reset(); *************** *** 117,120 **** --- 107,152 ---- /** + * Read messageSize bytes from buffer, create message + * and add to UDP receive queue. + */ + void tcConnectionData::ReadNextMessageUDP(unsigned int messageSize, + unsigned char *buffer) + { + if (messageSize == 0) + { + std::cerr << "Error - empty UDP message received" << std::endl; + return; + } + if (messageSize > tcMessage::BUFFER_SIZE) + { + std::cerr << "Error - UDP message size too large" + << std::endl; + return; + } + + int bufferIdx = networkInterface->CheckoutMessage(); + tcMessage *message = networkInterface->GetMessage(bufferIdx); + if (message == NULL) + { + std::cerr << "Error - Message buffer full, UDP receive message lost" + << std::endl; + return; + } + + + memcpy(message->data.buffer, buffer, messageSize); + + message->StampTime(); + + readQueueUDP.push(bufferIdx); + + fprintf(stdout, " Received UDP message, size: %d, id:%d, t:%d\n", + message->GetMessageSize(), message->GetMessageId(), + message->GetMessageTimestamp()); + + } + + + /** * Adds message idx to back of TCP send queue */ *************** *** 125,128 **** --- 157,168 ---- /** + * Adds message idx to back of UDP send queue + */ + void tcConnectionData::SendUDP(unsigned int idx, bool useAck) + { + writeQueueUDP.push(idx); + } + + /** * */ *************** *** 132,136 **** //ReadNextMessage(); ! WriteQueuedMessage(); } --- 172,176 ---- //ReadNextMessage(); ! WriteQueuedMessages(); } *************** *** 140,148 **** * is exceeded, writes part of the message only. */ ! void tcConnectionData::WriteQueuedMessage() { ! if (writeQueueTCP.empty()) return; int bufferId = writeQueueTCP.front(); tcMessage *message = networkInterface->GetMessage(bufferId); if (message == NULL) { --- 180,204 ---- * is exceeded, writes part of the message only. */ ! void tcConnectionData::WriteQueuedMessages() { ! ! WriteTCP(); ! ! WriteUDP(); ! ! ! } ! ! /** ! * ! */ ! void tcConnectionData::WriteTCP() ! { ! if (writeQueueTCP.empty()) return; ! int bufferId = writeQueueTCP.front(); + tcMessage *message = networkInterface->GetMessage(bufferId); + if (message == NULL) { *************** *** 153,205 **** //socket->SetFlags(wxSOCKET_WAITALL); ! const unsigned idx1 = sizeof(message->messageSize); ! const unsigned idx2 = sizeof(message->messageSize) + sizeof(message->id); - if (message->bufferIdx < idx1) - { - // write message size field - socket->Write(&message->messageSize + message->bufferIdx, - idx1 - message->bufferIdx); - message->bufferIdx += socket->LastCount(); - if (message->bufferIdx < idx1) return; - } if (socket->Error()) { - int gg = 4; - wxSocketError err = socket->LastError(); - } - if (message->bufferIdx < idx2) - { - // write message id field - socket->Write(&message->id + message->bufferIdx - idx1, - idx2 - message->bufferIdx); - message->bufferIdx += socket->LastCount(); - if (message->bufferIdx < idx2) return; - } - if (socket->Error()) - { - int gg = 4; wxSocketError err = socket->LastError(); } - // write data - socket->Write(&message->buffer[message->bufferIdx - idx2], - message->messageSize - message->bufferIdx + idx2); - message->bufferIdx += socket->LastCount(); // pop message from queue and return message buffer if entire // message has been written ! if (message->bufferIdx >= (message->messageSize + idx2)) { fprintf(stdout,"Sent message, size:%d, id:%d, t:%d\n", ! message->messageSize, message->id, tcTime::Get30HzCount()); writeQueueTCP.pop(); networkInterface->ReturnMessage(bufferId); } ! if (socket->Error()) { ! int gg = 4; ! wxSocketError err = socket->LastError(); } --- 209,236 ---- //socket->SetFlags(wxSOCKET_WAITALL); ! socket->Write(message->data.buffer + message->bufferIdx, ! message->data.header.messageSize - message->bufferIdx); if (socket->Error()) { wxSocketError err = socket->LastError(); + fprintf(stderr, "Error - SocketError %d\n", err); } message->bufferIdx += socket->LastCount(); // pop message from queue and return message buffer if entire // message has been written ! if (message->bufferIdx >= message->data.header.messageSize) { fprintf(stdout,"Sent message, size:%d, id:%d, t:%d\n", ! message->GetMessageSize(), message->GetMessageId(), tcTime::Get30HzCount()); writeQueueTCP.pop(); networkInterface->ReturnMessage(bufferId); } ! else { ! fprintf(stdout,"Sent partial message, buff_idx:%d, id:%d, t:%d\n", ! message->bufferIdx, message->GetMessageId(), tcTime::Get30HzCount()); } *************** *** 208,211 **** --- 239,287 ---- } + void tcConnectionData::WriteUDP() + { + if (writeQueueUDP.empty()) return; + + wxASSERT(networkInterface->GetDatagramSocket()); + + int bufferId = writeQueueUDP.front(); + + tcMessage *message = networkInterface->GetMessage(bufferId); + + if (message == NULL) + { + std::cerr << "Error - bad message buffer idx." << std::endl; + writeQueueTCP.pop(); + return; + } + + wxIPV4address addr; + socket->GetPeer(addr); + addr.Service(tcNetworkInterface::UDP_PORT); + + wxString peerName = addr.Hostname(); + + wxDatagramSocket *datagramSock = networkInterface->GetDatagramSocket(); + if (datagramSock == NULL) + { + std::cerr << "Error - NULL datagram socket" << std::endl; + return; + } + datagramSock->SendTo(addr, message->data.buffer, message->data.header.messageSize); + if (datagramSock->Error()) + { + wxSocketError err = socket->LastError(); + fprintf(stderr, "Error - SocketError %d\n", err); + } + + fprintf(stdout,"Sent UDP packet to %s, size:%d, id:%d, t:%d\n", + peerName.c_str(), message->GetMessageSize(), message->GetMessageId(), tcTime::Get30HzCount()); + + writeQueueUDP.pop(); + + networkInterface->ReturnMessage(bufferId); + + } + /** * tcConnectionData default constructor Index: tcMessage.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMessage.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcMessage.cpp 2 Mar 2004 02:52:15 -0000 1.2 --- tcMessage.cpp 6 Mar 2004 20:52:29 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- #include "network/tcMessage.h" + #include "tcTime.h" #include <iostream> *************** *** 32,45 **** /** * Reset message state to default / uninitialized */ void tcMessage::Reset() ! { ! id = -1; ! sourceId = -1; timestamp = 0; bufferIdx = 0; ! messageSize = 0; } --- 33,121 ---- + + /** + * @return pointer to start of message data portion of message (follows header) + */ + const unsigned char * tcMessage::GetMessageData() + { + return (data.buffer + HEADER_SIZE); + } + + + + /** + * @return message id from message header + */ + int tcMessage::GetMessageId() + { + return data.header.id; + } + + /** + * @return size of message in bytes not including header + */ + unsigned int tcMessage::GetMessageSize() + { + if (data.header.messageSize >= HEADER_SIZE) + { + return data.header.messageSize - HEADER_SIZE; + } + else + { + wxASSERT(data.header.messageSize >= HEADER_SIZE); + return 0; + } + } + + /** + * + */ + unsigned int tcMessage::GetMessageTimestamp() + { + return timestamp; + } + + /** + * @param messageSize size of data without any header info + * @param data pointer to messageSize bytes of message data + */ + void tcMessage::PopulateMessage(int sourceId, int messageId, unsigned messageSize, + const unsigned char *messageData) + { + if (messageSize > tcMessage::MESSAGE_SIZE) + { + std::cerr << "Error - Attempted to send oversized message, truncating." << std::endl; + messageSize = tcMessage::MESSAGE_SIZE; + } + bufferIdx = 0; + timestamp = tcTime::Get30HzCount(); + + data.header.messageSize = messageSize + HEADER_SIZE; + data.header.sourceId = sourceId; + data.header.id = messageId; + + memcpy(data.buffer + HEADER_SIZE, messageData, messageSize); + + + } + /** * Reset message state to default / uninitialized */ void tcMessage::Reset() ! { timestamp = 0; bufferIdx = 0; ! data.header.messageSize = 0; ! data.header.id = -1; ! data.header.sourceId = -1; ! } ! ! /** ! * Sets timestamp using current time ! */ ! void tcMessage::StampTime() ! { ! timestamp = tcTime::Get30HzCount(); } *************** *** 57,68 **** tcMessage::tcMessage(const tcMessage& source) { - id = source.id;; timestamp = source.timestamp; - sourceId = source.sourceId; bufferIdx = source.bufferIdx; ! messageSize = source.messageSize; ! wxASSERT(messageSize <= BUFFER_SIZE); ! if (messageSize > BUFFER_SIZE) messageSize = BUFFER_SIZE; ! memcpy(buffer, source.buffer, messageSize); } --- 133,144 ---- tcMessage::tcMessage(const tcMessage& source) { timestamp = source.timestamp; bufferIdx = source.bufferIdx; ! ! data.header.sourceId = source.data.header.sourceId; ! data.header.messageSize = source.data.header.messageSize; ! wxASSERT(data.header.messageSize <= BUFFER_SIZE); ! if (data.header.messageSize > BUFFER_SIZE) data.header.messageSize = BUFFER_SIZE; ! memcpy(data.buffer, source.data.buffer, data.header.messageSize); } *************** *** 72,83 **** const tcMessage& tcMessage::operator=(const tcMessage& rhs) { - id = rhs.id;; timestamp = rhs.timestamp; - sourceId = rhs.sourceId; bufferIdx = rhs.bufferIdx; ! messageSize = rhs.messageSize; ! wxASSERT(messageSize <= BUFFER_SIZE); ! if (messageSize > BUFFER_SIZE) messageSize = BUFFER_SIZE; ! memcpy(buffer, rhs.buffer, messageSize); return *this; --- 148,162 ---- const tcMessage& tcMessage::operator=(const tcMessage& rhs) { timestamp = rhs.timestamp; bufferIdx = rhs.bufferIdx; ! ! data.header.id = rhs.data.header.id;; ! ! data.header.sourceId = rhs.data.header.sourceId; ! ! data.header.messageSize = rhs.data.header.messageSize; ! wxASSERT(data.header.messageSize <= BUFFER_SIZE); ! if (data.header.messageSize > BUFFER_SIZE) data.header.messageSize = BUFFER_SIZE; ! memcpy(data.buffer, rhs.data.buffer, data.header.messageSize); return *this; Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcMultiplayerInterface.cpp 2 Mar 2004 02:52:15 -0000 1.2 --- tcMultiplayerInterface.cpp 6 Mar 2004 20:52:29 -0000 1.3 *************** *** 29,32 **** --- 29,35 ---- #include "network/tcMultiplayerInterface.h" #include <iostream> + #include <queue> + #include "tcSound.h" + #include "tcTime.h" BEGIN_NAMESPACE(network) *************** *** 69,72 **** --- 72,98 ---- } + bool tcMultiplayerInterface::IsNewPlayer(int id) + { + std::map<int,tcPlayerStatus>::const_iterator mapIter; + + mapIter = playerInfo.find(id); + if (mapIter == playerInfo.end()) + { + return true; + } + else + { + return false; + } + } + + /** + * @return true if acting as a server + */ + bool tcMultiplayerInterface::IsServer() + { + return networkInterface->IsServer(); + } + void tcMultiplayerInterface::MakeClient() { *************** *** 88,92 **** */ void tcMultiplayerInterface::ProcessMessage(int connectionId, int messageId, ! unsigned messageSize, unsigned char *data) { switch (messageId) --- 114,118 ---- */ void tcMultiplayerInterface::ProcessMessage(int connectionId, int messageId, ! unsigned messageSize, const unsigned char *data) { switch (messageId) *************** *** 124,132 **** { int connId = networkInterface->GetConnectionId(n); ! unsigned char *data = networkInterface->ReceiveMessage(connId, messageId, messageSize, tcNetworkInterface::TCP); ! if (data != NULL) { ! ProcessMessage(connId, messageId, messageSize, data); } } --- 150,165 ---- { int connId = networkInterface->GetConnectionId(n); ! const unsigned char *tcp_data = networkInterface->ReceiveMessage(connId, messageId, messageSize, tcNetworkInterface::TCP); ! if (tcp_data != NULL) { ! ProcessMessage(connId, messageId, messageSize, tcp_data); ! } ! ! const unsigned char *udp_data = networkInterface->ReceiveMessage(connId, messageId, ! messageSize, tcNetworkInterface::UDP); ! if (udp_data != NULL) ! { ! ProcessMessage(connId, messageId, messageSize, udp_data); } } *************** *** 141,144 **** --- 174,179 ---- char buff[256]; + int protocol = tcpChat ? tcNetworkInterface::TCP : tcNetworkInterface::UDP; + size_t messageLength = message.length(); if (messageLength > 255) messageLength = 255; *************** *** 146,152 **** --- 181,217 ---- buff[messageLength] = 0; networkInterface->SendMessage(destination, MSG_CHATTEXT, + (unsigned)(messageLength+1), (unsigned char*)buff, + protocol); + /** + networkInterface->SendMessage(destination, MSG_CHATTEXT, (unsigned)(messageLength+1), (unsigned char*)buff); + */ } + void tcMultiplayerInterface::SendTestUDP(int destination, std::string message) + { + size_t messageLength = message.length(); + if (messageLength > 255) messageLength = 255; + networkInterface->SendMessage( + destination, MSG_CHATTEXT, + (unsigned)(messageLength+1), (unsigned char*)message.c_str(), + tcNetworkInterface::UDP); + } + + /** + * 0 - UDP, otherwise - TCP + */ + void tcMultiplayerInterface::SetChatProtocol(int code) + { + if (code) + { + tcpChat = true; + } + else + { + tcpChat = false; // use UDP + } + } + /** * This must be called regularly to perform network functions. *************** *** 159,165 **** --- 224,289 ---- // process receive messages ProcessReceiveMessages(); + + UpdatePlayerInfo(); + } + + + /** + * + */ + void tcMultiplayerInterface::UpdatePlayerInfo() + { + static unsigned lastUpdate = 0; + unsigned currentTime = tcTime::Get30HzCount(); + if (currentTime - lastUpdate < 5) return; + + lastUpdate = currentTime; + + // add new connections + unsigned nConn = networkInterface->GetNumConnections(); + for (unsigned n=0;n<nConn;n++) + { + int connId = networkInterface->GetConnectionId(n); + if (IsNewPlayer(connId)) + { + tcPlayerStatus stat; + stat.timestamp = tcTime::Get30HzCount(); + playerInfo[connId] = stat; + tcSound::Get()->PlayEffect("intercom"); + } + else + { + playerInfo[connId].timestamp = tcTime::Get30HzCount(); + } + } + + + std::queue<int> eraseKeys; + + for (std::map<int,tcPlayerStatus>::iterator iter = playerInfo.begin(); + iter != playerInfo.end(); ++iter) + { + unsigned t = iter->second.timestamp; + // key is in iter->first, value in iter->second + if (currentTime - t > 15) + { + eraseKeys.push(iter->first); + tcSound::Get()->PlayEffect("fslide"); + } + } + + while (!eraseKeys.empty()) + { + playerInfo.erase(eraseKeys.front()); + eraseKeys.pop(); + } } + + + + tcMultiplayerInterface::tcMultiplayerInterface() + : tcpChat(true) { networkInterface = new tcNetworkInterface(); Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcNetworkInterface.cpp 2 Mar 2004 02:52:15 -0000 1.5 --- tcNetworkInterface.cpp 6 Mar 2004 20:52:29 -0000 1.6 *************** *** 201,204 **** --- 201,225 ---- } + + /** + * Lookup connection by peerName and return pointer to connection data + * @return NULL if idx is invalid, pointer to connection data otherwise + */ + tcConnectionData* tcNetworkInterface::GetConnection(std::string peerName) + { + std::map<std::string,int>::const_iterator mapIter; + + mapIter = peerMap.find(peerName); + if (mapIter == peerMap.end()) + { + return NULL; + } + int connectionIdx = mapIter->second; + + return GetConnection(connectionIdx); + } + + + tcMessage* tcNetworkInterface::GetMessage(int id) { *************** *** 231,234 **** --- 252,289 ---- /** + * Initializes UDP datagram socket + * See google groups post "Problem with RecvFrom in wxDatagramSocket (Windows XP)" + */ + void tcNetworkInterface::InitializeUDP() + { + if (datagramSock) return; // already initialized + + wxIPV4address addr; + if (!addr.AnyAddress()) + { + std::cerr << "Error - error configuring datagram socket." << std::endl; + return; + } + addr.Service(UDP_PORT); + + datagramSock = new wxDatagramSocket(addr, wxSOCKET_NOWAIT); + //datagramSocket->SetTimeout(1); + datagramSock->SetEventHandler(*this, UDP_EVENT_ID); + datagramSock->SetNotify(wxSOCKET_INPUT_FLAG); + datagramSock->Notify(TRUE); + + datagramSock->GetLocal(addr); + if (!datagramSock->Ok()) + { + fprintf(stderr, "Error - Dgram sock cannot listen at port %d\n", + addr.Service()); + return; + } + + fprintf(stdout, "Created datagram socket on port %d\n", + addr.Service()); + } + + /** * @return true if this interface is acting as a server */ *************** *** 268,271 **** --- 323,328 ---- // subscribe to no events, use polling clientSock->Notify(FALSE); + + InitializeUDP(); } *************** *** 300,303 **** --- 357,362 ---- //serverSock->Notify(FALSE); serverSock->SetFlags(wxSOCKET_NOWAIT); + + InitializeUDP(); } *************** *** 310,319 **** case wxSOCKET_INPUT: { ! std::cout << "wxSOCKET_INPUT"; ! int connectionIdx = LookupConnectionIndex(event.m_id); ! tcConnectionData *conn = GetConnection(connectionIdx); ! if (conn) { ! conn->ReadNextMessage(); } --- 369,386 ---- case wxSOCKET_INPUT: { ! if (event.m_id == UDP_EVENT_ID) { ! std::cout << "wxSOCKET_INPUT - UDP"; ! RouteUDP(); ! } ! else ! { ! std::cout << "wxSOCKET_INPUT - TCP"; ! int connectionIdx = LookupConnectionIndex(event.m_id); ! tcConnectionData *conn = GetConnection(connectionIdx); ! if (conn) ! { ! conn->ReadNextMessageTCP(); ! } } *************** *** 454,470 **** * @return pointer to message data, data should be immediately used or copied to store */ ! unsigned char* tcNetworkInterface::ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol) { - if (protocol != TCP) return NULL; // only TCP supported right now - int connectionIdx = LookupConnectionIndex(connectionId); tcConnectionData *conn = GetConnection(connectionIdx); if (conn == NULL) return NULL; // get next message in queue ! if (conn->readQueueTCP.empty()) return NULL; // no messages ! int bufferIdx = conn->readQueueTCP.front(); ! conn->readQueueTCP.pop(); tcMessage *message = GetMessage(bufferIdx); --- 521,550 ---- * @return pointer to message data, data should be immediately used or copied to store */ ! const unsigned char* tcNetworkInterface::ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol) { int connectionIdx = LookupConnectionIndex(connectionId); tcConnectionData *conn = GetConnection(connectionIdx); if (conn == NULL) return NULL; + std::queue<unsigned int> *messageQueue; + + if (protocol == TCP) + { + messageQueue = &conn->readQueueTCP; + } + else if (protocol == UDP) + { + messageQueue = &conn->readQueueUDP; + } + else + { + return NULL; // only TCP and UDP supported + } + // get next message in queue ! if (messageQueue->empty()) return NULL; // no messages ! int bufferIdx = messageQueue->front(); ! messageQueue->pop(); tcMessage *message = GetMessage(bufferIdx); *************** *** 475,483 **** } ! messageId = message->id; ! messageSize = message->messageSize; ReturnMessage(bufferIdx); // dangerous, fix this ! return message->buffer; } --- 555,590 ---- } ! messageId = message->GetMessageId(); ! messageSize = message->GetMessageSize(); ReturnMessage(bufferIdx); // dangerous, fix this ! return message->GetMessageData(); ! } ! ! void tcNetworkInterface::RouteUDP() ! { ! static unsigned char buff[MAX_UDP_SIZE]; ! wxIPV4address peerAddr; ! unsigned int messageSize; ! ! messageSize = MAX_UDP_SIZE; ! ! datagramSock->RecvFrom(peerAddr, buff, MAX_UDP_SIZE); ! wxString peerName = peerAddr.Hostname(); ! unsigned readCount = datagramSock->LastCount(); ! ! /* ! fprintf(stdout, "Received UDP from %s, size: %d, data: %s\n", ! peerName.c_str(), readCount, (char*)buff); ! */ ! ! tcConnectionData *conn = GetConnection(peerName.c_str()); ! if (conn == NULL) ! { ! std::cerr << "Error - RouteUDP() peer name not found" ! << std::endl; ! return; ! } ! conn->ReadNextMessageUDP(readCount, buff); } *************** *** 485,489 **** const unsigned char *data, int protocol) { ! if (protocol != TCP) return false; // only TCP supported right now int connectionIdx = LookupConnectionIndex(connectionId); --- 592,597 ---- const unsigned char *data, int protocol) { ! ! if ((protocol != TCP)&&(protocol != UDP)) return false; // only TCP and UDP supported right now int connectionIdx = LookupConnectionIndex(connectionId); *************** *** 494,503 **** } - if (messageSize > tcMessage::BUFFER_SIZE) - { - std::cerr << "Error - Attempted to send oversized message." << std::endl; - return false; - } - // checkout new message int bufferIdx = CheckoutMessage(); --- 602,605 ---- *************** *** 506,517 **** // populate message ! message->id = messageId; ! message->messageSize = messageSize; ! message->sourceId = connectionId; ! message->timestamp = tcTime::Get30HzCount(); ! memcpy(message->buffer, data, messageSize); - connectionData[connectionIdx].SendTCP(bufferIdx); return true; --- 608,622 ---- // populate message ! message->PopulateMessage(connectionId, messageId, messageSize, data); ! if (protocol == TCP) ! { ! connectionData[connectionIdx].SendTCP(bufferIdx); ! } ! else if (protocol == UDP) ! { ! connectionData[connectionIdx].SendUDP(bufferIdx); ! } return true; *************** *** 526,533 **** --- 631,640 ---- void tcNetworkInterface::Update() { + /* static unsigned lastUpdate = tcTime::Get30HzCount(); if ((tcTime::Get30HzCount() - lastUpdate) < 15) return; lastUpdate = tcTime::Get30HzCount(); + */ if (isServer) { *************** *** 596,600 **** /** ! * Update connectionLookup map (by clearing and rebuilding) * This should be called after adding or deleting a connection. */ --- 703,707 ---- /** ! * Update connectionLookup and peerMap maps (by clearing and rebuilding) * This should be called after adding or deleting a connection. */ *************** *** 602,610 **** --- 709,725 ---- { connectionLookup.clear(); + peerMap.clear(); + size_t nConnections = connectionData.size(); for(size_t n=0;n<nConnections;n++) { + wxIPV4address peerAddr; + connectionLookup[connectionData[n].id] = (int)n; + + connectionData[n].socket->GetPeer(peerAddr); + std::string hostName = peerAddr.Hostname().c_str(); + peerMap[hostName] = (int)n; } } *************** *** 631,635 **** connectionStartTime(0), clientSock(NULL), ! serverSock(NULL) { tcConnectionData::networkInterface = this; --- 746,751 ---- connectionStartTime(0), clientSock(NULL), ! serverSock(NULL), ! datagramSock(NULL) { tcConnectionData::networkInterface = this; *************** *** 640,643 **** --- 756,762 ---- tcNetworkInterface::~tcNetworkInterface() { + if (clientSock) {clientSock->Destroy();} + if (serverSock) {serverSock->Destroy();} + if (datagramSock) {datagramSock->Destroy();} } |
|
From: <ddc...@us...> - 2004-03-02 03:03:46
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13312/include/graphics Modified Files: tcEditBox.h Log Message: Index: tcEditBox.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcEditBox.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcEditBox.h 27 Feb 2004 00:07:58 -0000 1.1 --- tcEditBox.h 2 Mar 2004 02:52:14 -0000 1.2 *************** *** 38,41 **** --- 38,42 ---- void SetBuffer(const char* azBuffer); void SetCaption(const char* azCaption); + void SetClearOnReturn(bool state) {clearOnReturn = state;} void SetCommand(long cmd) {command = cmd;} *************** *** 50,53 **** --- 51,56 ---- bool isFocused; bool textChanged; + bool drawBackground; ///< true to draw image or default solid color background + bool clearOnReturn; ///< clear text after ENTER is pressed, will also post text update message Gdiplus::RectF mrectTextBar; // region for text to be displayed Gdiplus::RectF mrectTextCaption; // caption region |
|
From: <ddc...@us...> - 2004-03-02 03:03:46
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13312/src/graphics Modified Files: tcEditBox.cpp tcwindow.cpp Log Message: Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcEditBox.cpp 27 Feb 2004 00:07:59 -0000 1.1 --- tcEditBox.cpp 2 Mar 2004 02:52:14 -0000 1.2 *************** *** 53,65 **** if (!mbActive) {return;} ! if (IsBackgroundLoaded()) ! { ! DrawBackground(graphics); ! } ! else { ! // erase ! brush->SetColor(Color(255,0,15,50)); ! graphics->FillRectangle(brush,0,0,mnWidth,mnHeight); } --- 53,68 ---- if (!mbActive) {return;} ! if (drawBackground) { ! if (IsBackgroundLoaded()) ! { ! DrawBackground(graphics); ! } ! else ! { ! // erase ! brush->SetColor(Color(255,0,15,50)); ! graphics->FillRectangle(brush,0,0,mnWidth,mnHeight); ! } } *************** *** 157,161 **** ! void tcEditBox::OnKeyDown(wxKeyEvent& event) { --- 160,167 ---- ! /** ! * If clearOnReturn is true, a text updated event will be posted ! * and the text will be cleared when the return key is pressed. ! */ void tcEditBox::OnKeyDown(wxKeyEvent& event) { *************** *** 165,169 **** if (keycode == WXK_RETURN) { ! if (textChanged) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; --- 171,175 ---- if (keycode == WXK_RETURN) { ! if ((textChanged)&&(clearOnReturn)) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; *************** *** 171,174 **** --- 177,181 ---- command.SetString(mzBuffer); AddPendingEvent(command); // TODO add handler added in tcGame for this event + strcpy(mzBuffer,""); textChanged = false; } *************** *** 180,183 **** --- 187,195 ---- textChanged = true; } + else if (keycode == WXK_ESCAPE) + { + wxASSERT(GetParent()); + GetParent()->SetFocus(); + } else { *************** *** 221,227 **** } void tcEditBox::OnKillFocus(wxFocusEvent& event) { ! if (textChanged) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; --- 233,243 ---- } + /** + * If clearOnReturn is false, a text updated event will be posted + * when the focus is lost. + */ void tcEditBox::OnKillFocus(wxFocusEvent& event) { ! if ((textChanged)&&(!clearOnReturn)) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; *************** *** 251,255 **** isMouseOver(false), isFocused(false), ! textChanged(false), command(0) { --- 267,273 ---- isMouseOver(false), isFocused(false), ! textChanged(true), ! drawBackground(true), ! clearOnReturn(false), command(0) { *************** *** 288,291 **** --- 306,311 ---- mrectTextCaption = mrectTextBar; mrectTextCaption.Offset(-2,-mrectTextBar.Height-2); + + drawBackground = (mrectTextBar.Width < (float)width); } Index: tcwindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcwindow.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcwindow.cpp 29 Feb 2004 22:51:36 -0000 1.21 --- tcwindow.cpp 2 Mar 2004 02:52:14 -0000 1.22 *************** *** 594,598 **** mpBrushDefault->SetColor(startcolor); } ! else { apGraphics->DrawImage(mpiBackground,0,0); } --- 594,599 ---- mpBrushDefault->SetColor(startcolor); } ! else ! { apGraphics->DrawImage(mpiBackground,0,0); } |
|
From: <ddc...@us...> - 2004-03-02 03:03:46
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13312/include/sim Modified Files: tcNetworkView.h Log Message: Index: tcNetworkView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcNetworkView.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcNetworkView.h 29 Feb 2004 22:51:35 -0000 1.3 --- tcNetworkView.h 2 Mar 2004 02:52:14 -0000 1.4 *************** *** 33,36 **** --- 33,37 ---- class tcEditBox; + class tcConsoleBox; /** *************** *** 51,55 **** void SetNetworkMode(wxCommandEvent& event); - tcNetworkView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, --- 52,55 ---- *************** *** 60,63 **** --- 60,66 ---- int networkMode; tcEditBox *ipEdit; + tcConsoleBox *chatBox; + tcEditBox *chatEntry; + wxRect statusBoxBounds; DECLARE_EVENT_TABLE() |
|
From: <ddc...@us...> - 2004-03-02 03:03:46
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13312 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** GCblue.vcproj 29 Feb 2004 22:51:34 -0000 1.44 --- GCblue.vcproj 2 Mar 2004 02:52:13 -0000 1.45 *************** *** 226,229 **** --- 226,232 ---- </File> <File + RelativePath="src\graphics\tcConsoleBox.cpp"> + </File> + <File RelativePath="src\graphics\tcEditBox.cpp"> </File> *************** *** 578,581 **** --- 581,587 ---- </File> <File + RelativePath="include\graphics\tcConsoleBox.h"> + </File> + <File RelativePath="include\graphics\tcEditBox.h"> </File> |
|
From: <ddc...@us...> - 2004-03-02 03:03:43
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13312/src/network Modified Files: tcConnectionData.cpp tcMessage.cpp tcMultiplayerInterface.cpp tcNetworkInterface.cpp Log Message: Index: tcConnectionData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcConnectionData.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcConnectionData.cpp 29 Feb 2004 22:51:36 -0000 1.1 --- tcConnectionData.cpp 2 Mar 2004 02:52:14 -0000 1.2 *************** *** 39,47 **** * Attempts to read next whole message. If message is incomplete, the partial * message is returned to the socket read buffer. This method does not block. ! * Uses tempMessage for temporary storage. If return message is to be stored, ! * the message must be COPIED. Do not store the pointer. ! * @return pointer to new message if entire message is ready, otherwise NULL */ ! tcMessage* tcConnectionData::ReadNextMessage() { wxASSERT(socket); --- 39,46 ---- * Attempts to read next whole message. If message is incomplete, the partial * message is returned to the socket read buffer. This method does not block. ! * Uses tempMessage for temporary storage. When the complete message is collected ! * the idx is stored in the appropriate receive queue. */ ! void tcConnectionData::ReadNextMessage() { wxASSERT(socket); *************** *** 68,72 **** } ! if (tempMessage.id == -1) return NULL; // Read message --- 67,75 ---- } ! if (tempMessage.id == -1) ! { ! fprintf(stdout, " Read partial message: %d bytes of data\n", tempMessage.bufferIdx); ! return; ! } // Read message *************** *** 77,103 **** if (tempMessage.bufferIdx >= tempMessage.messageSize) { - tempMessage.bufferIdx = 0; // reset bufferIdx } else { ! fprintf(stdout, "Read %d bytes of data\n", tempMessage.bufferIdx); ! return NULL; } - //socket->SetFlags(wxSOCKET_NOWAIT); - tempMessage.buffer[256] = 0; std::string testString; testString = (char*)tempMessage.buffer; ! fprintf(stdout, "Received message, size: %d, id:%d, data:%s\n", ! tempMessage.messageSize, tempMessage.id, testString.c_str()); ! wxMessageBox(testString.c_str(),"Message",wxOK); ! tempMessage.Reset(); - return &tempMessage; } --- 80,117 ---- if (tempMessage.bufferIdx >= tempMessage.messageSize) { } else { ! fprintf(stdout, " Read partial message: %d bytes of data\n", tempMessage.bufferIdx); ! return; } std::string testString; testString = (char*)tempMessage.buffer; ! /* ! tempMessage.buffer[256] = 0; wxMessageBox(testString.c_str(),"Message",wxOK); ! */ ! ! int bufferIdx = networkInterface->CheckoutMessage(); ! tcMessage *message = networkInterface->GetMessage(bufferIdx); ! if (message == NULL) ! { ! std::cerr << "Error - Message buffer full, receive message lost" << std::endl; ! tempMessage.Reset(); ! return; ! } ! ! *message = tempMessage; ! readQueueTCP.push(bufferIdx); ! ! fprintf(stdout, " Received message, size: %d, id:%d, t:%d data:%s\n", ! tempMessage.messageSize, tempMessage.id, tcTime::Get30HzCount(), testString.c_str()); ! tempMessage.Reset(); } *************** *** 137,141 **** return; } ! // socket->SetFlags(wxSOCKET_WAITALL); const unsigned idx1 = sizeof(message->messageSize); --- 151,155 ---- return; } ! //socket->SetFlags(wxSOCKET_WAITALL); const unsigned idx1 = sizeof(message->messageSize); *************** *** 179,182 **** --- 193,198 ---- if (message->bufferIdx >= (message->messageSize + idx2)) { + fprintf(stdout,"Sent message, size:%d, id:%d, t:%d\n", + message->messageSize, message->id, tcTime::Get30HzCount()); writeQueueTCP.pop(); networkInterface->ReturnMessage(bufferId); *************** *** 187,191 **** wxSocketError err = socket->LastError(); } ! // socket->SetFlags(wxSOCKET_NOWAIT); } --- 203,209 ---- wxSocketError err = socket->LastError(); } ! ! ! //socket->SetFlags(wxSOCKET_NOWAIT); } Index: tcMessage.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMessage.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcMessage.cpp 29 Feb 2004 22:51:36 -0000 1.1 --- tcMessage.cpp 2 Mar 2004 02:52:15 -0000 1.2 *************** *** 67,69 **** --- 67,86 ---- } + /** + * Assignment operator + */ + const tcMessage& tcMessage::operator=(const tcMessage& rhs) + { + id = rhs.id;; + timestamp = rhs.timestamp; + sourceId = rhs.sourceId; + bufferIdx = rhs.bufferIdx; + messageSize = rhs.messageSize; + wxASSERT(messageSize <= BUFFER_SIZE); + if (messageSize > BUFFER_SIZE) messageSize = BUFFER_SIZE; + memcpy(buffer, rhs.buffer, messageSize); + + return *this; + } + END_NAMESPACE \ No newline at end of file Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcMultiplayerInterface.cpp 29 Feb 2004 22:51:36 -0000 1.1 --- tcMultiplayerInterface.cpp 2 Mar 2004 02:52:15 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- #include "network/tcNetworkInterface.h" #include "network/tcMultiplayerInterface.h" + #include <iostream> BEGIN_NAMESPACE(network) *************** *** 40,43 **** --- 41,52 ---- } + std::string tcMultiplayerInterface::GetChatText() + { + if (chatText.empty()) return "ERROR"; + std::string text = chatText.front(); + chatText.pop(); + return text; + } + int tcMultiplayerInterface::GetConnectionId(unsigned connectionIdx) { *************** *** 55,58 **** --- 64,72 ---- } + bool tcMultiplayerInterface::IsChatTextAvail() + { + return !chatText.empty(); + } + void tcMultiplayerInterface::MakeClient() { *************** *** 70,78 **** } /** * Sends a test message of text to destination */ ! void tcMultiplayerInterface::SendTestMessage(int destination, std::string message) { char buff[256]; --- 84,141 ---- } + /** + * Process single receive message for connection associated with connectionId + */ + void tcMultiplayerInterface::ProcessMessage(int connectionId, int messageId, + unsigned messageSize, unsigned char *data) + { + switch (messageId) + { + case MSG_CHATTEXT: + chatText.push(std::string((char*)data)); + if (networkInterface->IsServer()) + { + // broadcast chat text to all clients + unsigned nConn = networkInterface->GetNumConnections(); + for (unsigned n=0;n<nConn;n++) + { + int connId = networkInterface->GetConnectionId(n); + SendChatText(connId, (char*)data); + } + } + break; + default: + std::cerr << "Error - tcMultiplayerInterface::ProcessMessage unrecognized message" + << std::endl; + break; + } + } + + /** + * + */ + void tcMultiplayerInterface::ProcessReceiveMessages() + { + int messageId; + unsigned messageSize; + + unsigned nConn = networkInterface->GetNumConnections(); + for (unsigned n=0;n<nConn;n++) + { + int connId = networkInterface->GetConnectionId(n); + unsigned char *data = networkInterface->ReceiveMessage(connId, messageId, + messageSize, tcNetworkInterface::TCP); + if (data != NULL) + { + ProcessMessage(connId, messageId, messageSize, data); + } + } + } + /** * Sends a test message of text to destination */ ! void tcMultiplayerInterface::SendChatText(int destination, std::string message) { char buff[256]; *************** *** 82,86 **** strncpy(buff, message.c_str(), messageLength); buff[messageLength] = 0; ! networkInterface->SendMessage(destination, 1, (unsigned)(messageLength+1), (unsigned char*)buff); } --- 145,149 ---- strncpy(buff, message.c_str(), messageLength); buff[messageLength] = 0; ! networkInterface->SendMessage(destination, MSG_CHATTEXT, (unsigned)(messageLength+1), (unsigned char*)buff); } *************** *** 93,96 **** --- 156,162 ---- { networkInterface->Update(); + + // process receive messages + ProcessReceiveMessages(); } Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcNetworkInterface.cpp 29 Feb 2004 22:51:36 -0000 1.4 --- tcNetworkInterface.cpp 2 Mar 2004 02:52:15 -0000 1.5 *************** *** 231,234 **** --- 231,242 ---- /** + * @return true if this interface is acting as a server + */ + bool tcNetworkInterface::IsServer() + { + return isServer; + } + + /** * Looks up connection index in connectionData vector based on connection id * @return connection index for connection id or -1 if not found or invalid *************** *** 443,453 **** } ! unsigned char* tcNetworkInterface::ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol) { if (protocol != TCP) return NULL; // only TCP supported right now int connectionIdx = LookupConnectionIndex(connectionId); ! return NULL; } --- 451,483 ---- } ! /** ! * @return pointer to message data, data should be immediately used or copied to store ! */ unsigned char* tcNetworkInterface::ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol) { if (protocol != TCP) return NULL; // only TCP supported right now + int connectionIdx = LookupConnectionIndex(connectionId); ! tcConnectionData *conn = GetConnection(connectionIdx); ! if (conn == NULL) return NULL; ! ! // get next message in queue ! if (conn->readQueueTCP.empty()) return NULL; // no messages ! int bufferIdx = conn->readQueueTCP.front(); ! conn->readQueueTCP.pop(); ! ! tcMessage *message = GetMessage(bufferIdx); ! if (message == NULL) ! { ! std::cerr << "Error - Bad index passed to GetMessage" << std::endl; ! return NULL; ! } ! ! messageId = message->id; ! messageSize = message->messageSize; ! ! ReturnMessage(bufferIdx); // dangerous, fix this ! return message->buffer; } |
|
From: <ddc...@us...> - 2004-03-02 03:03:43
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13312/src/sim Modified Files: Game.cpp tcNetworkView.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Game.cpp 29 Feb 2004 22:51:36 -0000 1.66 --- Game.cpp 2 Mar 2004 02:52:15 -0000 1.67 *************** *** 1018,1021 **** --- 1018,1022 ---- tcMultiplayerInterface::Get().Update(); + tcMultiplayerInterface::Get().Update(); startView->mbPlayEnabled = mcSimState.msScenarioInfo.mbLoaded; Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcNetworkView.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcNetworkView.cpp 29 Feb 2004 22:51:36 -0000 1.4 --- tcNetworkView.cpp 2 Mar 2004 02:52:15 -0000 1.5 *************** *** 31,34 **** --- 31,35 ---- #include "tcButton.h" #include "tcEditBox.h" + #include "tcConsoleBox.h" #include "tcXMLFile.h" #include "network/tcMultiplayerInterface.h" *************** *** 42,45 **** --- 43,47 ---- EVT_COMMAND(ID_CHATTEXT, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SendChatText) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetIPText) + EVT_COMMAND(2, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SendChatText) END_EVENT_TABLE() *************** *** 65,68 **** --- 67,76 ---- DrawStatusBox(pGraphics); + if (tcMultiplayerInterface::Get().IsChatTextAvail()) + { + chatBox->Print(tcMultiplayerInterface::Get().GetChatText().c_str()); + } + + ReleaseGraphics(pGraphics); *************** *** 89,94 **** std::string connectionStatus = tcMultiplayerInterface::Get().GetConnectionStatus(n); DrawText(graphics, font8, mpBrush, connectionStatus.c_str(), x, y); - } } --- 97,102 ---- std::string connectionStatus = tcMultiplayerInterface::Get().GetConnectionStatus(n); DrawText(graphics, font8, mpBrush, connectionStatus.c_str(), x, y); } + } *************** *** 112,116 **** void tcNetworkView::SendChatText(wxCommandEvent& event) { ! std::string chatText = "This is some test chat text."; unsigned nConnections = tcMultiplayerInterface::Get().GetNumConnections(); --- 120,124 ---- void tcNetworkView::SendChatText(wxCommandEvent& event) { ! std::string chatText = event.GetString().c_str(); unsigned nConnections = tcMultiplayerInterface::Get().GetNumConnections(); *************** *** 119,123 **** { int connId = tcMultiplayerInterface::Get().GetConnectionId(n); ! tcMultiplayerInterface::Get().SendTestMessage(connId, chatText); } --- 127,131 ---- { int connId = tcMultiplayerInterface::Get().GetConnectionId(n); ! tcMultiplayerInterface::Get().SendChatText(connId, chatText); } *************** *** 172,180 **** --- 180,191 ---- tcXMLNode root = config->GetRootNode(); + // add IP edit box tcXMLNode current = root.GetChildMatching("EditIP"); ipEdit = new tcEditBox(this, ¤t); ipEdit->SetCommand(1); + ipEdit->SetClearOnReturn(false); ipEdit->SetBuffer(""); + // read status box parameters current = root.GetChildMatching("StatusBox"); statusBoxBounds.x = current.GetChildMatching("X").GetAsInt(); *************** *** 183,186 **** --- 194,207 ---- statusBoxBounds.height = current.GetChildMatching("Height").GetAsInt(); + // add chat text console + current = root.GetChildMatching("ChatBox"); + chatBox = new tcConsoleBox(this, ¤t); + + // add chat text edit box + current = root.GetChildMatching("ChatEntry"); + chatEntry = new tcEditBox(this, ¤t); + chatEntry->SetCommand(2); + chatEntry->SetClearOnReturn(true); + chatEntry->SetBuffer("Enter chat text here"); } |
|
From: <ddc...@us...> - 2004-03-02 03:03:43
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13312/include/network Modified Files: tcConnectionData.h tcMessage.h tcMultiplayerInterface.h tcNetworkInterface.h Log Message: Index: tcConnectionData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcConnectionData.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcConnectionData.h 29 Feb 2004 22:51:35 -0000 1.1 --- tcConnectionData.h 2 Mar 2004 02:52:14 -0000 1.2 *************** *** 55,59 **** ! tcMessage* ReadNextMessage(); void SendTCP(unsigned int idx); void Update(); ///< read and write data from socket --- 55,59 ---- ! void ReadNextMessage(); void SendTCP(unsigned int idx); void Update(); ///< read and write data from socket Index: tcMessage.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMessage.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcMessage.h 29 Feb 2004 22:51:35 -0000 1.1 --- tcMessage.h 2 Mar 2004 02:52:14 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- tcMessage(); tcMessage(const tcMessage& source); + const tcMessage& operator=(const tcMessage& rhs); }; Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcMultiplayerInterface.h 29 Feb 2004 22:51:35 -0000 1.1 --- tcMultiplayerInterface.h 2 Mar 2004 02:52:14 -0000 1.2 *************** *** 25,31 **** #pragma once /* #include <vector> ! #include <queue> #include <map> */ --- 25,32 ---- #pragma once + #include <queue> /* #include <vector> ! #include <map> */ *************** *** 51,69 **** { public: static tcMultiplayerInterface& Get(); int GetConnectionId(unsigned connectionIdx); std::string GetConnectionStatus(unsigned connectionIdx); unsigned GetNumConnections(); void MakeClient(); void MakeServer(); void OpenConnection(std::string hostName); ! void SendTestMessage(int destination, std::string message); void Update(); private: tcNetworkInterface *networkInterface; tcMultiplayerInterface(); tcMultiplayerInterface(const tcMultiplayerInterface& source); --- 52,82 ---- { public: + enum + { + MSG_CHATTEXT = 1, + }; static tcMultiplayerInterface& Get(); + std::string GetChatText(); int GetConnectionId(unsigned connectionIdx); std::string GetConnectionStatus(unsigned connectionIdx); unsigned GetNumConnections(); + + bool IsChatTextAvail(); + void MakeClient(); void MakeServer(); void OpenConnection(std::string hostName); ! void SendChatText(int destination, std::string message); void Update(); private: tcNetworkInterface *networkInterface; + std::queue<std::string> chatText; ///< chat text to display + void ProcessMessage(int connectionId, int messageId, + unsigned messageSize, unsigned char *data); + void ProcessReceiveMessages(); tcMultiplayerInterface(); tcMultiplayerInterface(const tcMultiplayerInterface& source); Index: tcNetworkInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcNetworkInterface.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcNetworkInterface.h 29 Feb 2004 22:51:35 -0000 1.4 --- tcNetworkInterface.h 2 Mar 2004 02:52:14 -0000 1.5 *************** *** 58,61 **** --- 58,62 ---- tcMessage* GetMessage(int id); unsigned GetNumConnections(); + bool IsServer(); void MakeClient(); void MakeServer(); |
|
From: <ddc...@us...> - 2004-02-29 23:02:10
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13290/src/sim Modified Files: Game.cpp tcCreditView.cpp tcDirector.cpp tcDirectorEvent.cpp tcMapView.cpp tcNetworkView.cpp tcOOBView.cpp tcObjectControl.cpp tcRadar.cpp tcScenarioSelectView.cpp tcSimState.cpp tcStartView.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Game.cpp 27 Feb 2004 00:07:59 -0000 1.65 --- Game.cpp 29 Feb 2004 22:51:36 -0000 1.66 *************** *** 46,52 **** #include "cspDate.h" #include "tcDirector.h" - #include "network/tcNetworkInterface.h" #include "tcStandardWindow.h" #include "tcNetworkView.h" #if defined(_MSC_VER) --- 46,52 ---- #include "cspDate.h" #include "tcDirector.h" #include "tcStandardWindow.h" #include "tcNetworkView.h" + #include "network/tcMultiplayerInterface.h" #if defined(_MSC_VER) *************** *** 59,62 **** --- 59,63 ---- using namespace std; using namespace MapView; + using network::tcMultiplayerInterface; BEGIN_EVENT_TABLE(tcGame, wxFrame) *************** *** 247,251 **** { meScreenMode = CREDIT; ! mcSound.PlayMusic("tension1"); } --- 248,252 ---- { meScreenMode = CREDIT; ! tcSound::Get()->PlayMusic("tension1"); } *************** *** 269,273 **** if (meGameMode == GM_START) { ! if (meScreenMode == CREDIT) mcSound.PlayMusic("loop1"); meScreenMode = START; } --- 270,274 ---- if (meGameMode == GM_START) { ! if (meScreenMode == CREDIT) tcSound::Get()->PlayMusic("loop1"); meScreenMode = START; } *************** *** 351,355 **** InitializeCreditView(); InitializeNetworkView(); - InitializeNetwork(); InitializeScenarioSelectView(); --- 352,355 ---- *************** *** 438,444 **** void tcGame::StartMusic() { ! if (mcSound.Init()) { ! mcSound.Test(); } else --- 438,446 ---- void tcGame::StartMusic() { ! if (mcOptions.disableSound) return; ! ! if (tcSound::Get()->Init()) { ! tcSound::Get()->Test(); } else *************** *** 448,455 **** return; } - - tcWindow::AttachSound(&mcSound); ! mcSound.PlayMusic("loop1"); } --- 450,458 ---- return; } ! if (mcOptions.mbPlayMusic) ! { ! tcSound::Get()->PlayMusic("loop1"); ! } } *************** *** 472,476 **** startView->AttachOptions(&mcOptions); - startView->AttachSound(&mcSound); startView->LoadBackgroundImage("start_background.jpg"); --- 475,478 ---- *************** *** 499,503 **** optionsView->AttachOptions(&mcOptions); - optionsView->AttachSound(&mcSound); if (optionsView->Init() == false) --- 501,504 ---- *************** *** 510,524 **** /** - * Initialize network multiplayer objects - */ - void tcGame::InitializeNetwork() - { - networkInterface = new network::tcNetworkInterface(); - wxASSERT(networkView); - networkView->AttachNetworkInterface(networkInterface); - //networkInterface->MakeServer(); - } - - /** * Initialize network view interface * startView must be initialized before calling this --- 511,514 ---- *************** *** 550,554 **** throw "briefingConsoleLeft->CreateSurfaces failed"; } - briefingConsoleLeft->AttachSound(&mcSound); briefingConsoleLeft->SetEffect(SEFFECT_MUTEDBEEP); briefingConsoleLeft->InitGdi(10.0f,0xFF64FF64); --- 540,543 ---- *************** *** 575,579 **** throw "briefingConsoleBottom->CreateSurfaces failed"; } - briefingConsoleBottom->AttachSound(&mcSound); briefingConsoleBottom->SetEffect(-1); briefingConsoleBottom->InitGdi(10.0f,0xFF64FF64); --- 564,567 ---- *************** *** 601,605 **** } - creditView->AttachSound(&mcSound); creditView->LoadBackgroundImage("start_background.jpg"); --- 589,592 ---- *************** *** 620,624 **** wxASSERT(tacticalMap); wxASSERT(briefingConsoleLeft); ! director = new tcDirector(viewer, tacticalMap, &mcSound, briefingConsoleLeft, this); director->SetStartTime(0); director->InitTest(); // load test event sequence --- 607,611 ---- wxASSERT(tacticalMap); wxASSERT(briefingConsoleLeft); ! director = new tcDirector(viewer, tacticalMap, briefingConsoleLeft, this); director->SetStartTime(0); director->InitTest(); // load test event sequence *************** *** 641,645 **** scenarioSelectView->AttachSimState(&mcSimState); - scenarioSelectView->AttachSound(&mcSound); scenarioSelectView->LoadBackgroundImage("start_background.jpg"); --- 628,631 ---- *************** *** 670,674 **** tacticalMap->AttachOptions(&mcOptions); tacticalMap->AttachCommandInterface(&mcCommandQueue); - tacticalMap->AttachSound(&mcSound); tacticalMap->SetYMirror(mnHeight); // was 200 --- 656,659 ---- *************** *** 706,710 **** } - infoConsole->AttachSound(&mcSound); infoConsole->SetEffect(-1); //SEFFECT_MUTEDBEEP); // no sound infoConsole->InitGdi(10.0f,0xFF64FF64); --- 691,694 ---- *************** *** 756,760 **** } - objectControl->AttachSound(&mcSound); objectControl->AttachCommandInterface(&mcCommandQueue); objectControl->AttachSimState(&mcSimState); --- 740,743 ---- *************** *** 786,790 **** oobView->AttachMapView(tacticalMap); oobView->AttachSimState(&mcSimState); - oobView->AttachSound(&mcSound); oobView->mnAlliance = mcUserInfo.GetOwnAlliance(); // TODO: make this configurable oobView->SetSkipCount(mcOptions.renderSkipCount); --- 769,772 ---- *************** *** 829,833 **** mcWorldMap.AttachOptions(&mcOptions); mcWorldMap.AttachCommandInterface(&mcCommandQueue); - mcWorldMap.AttachSound(&mcSound); if(!mcWorldMap.CreateSurfaces(mpGraphicsEngine)) --- 811,814 ---- *************** *** 870,874 **** mcSimState.AttachMapData(&mcMapData); mcSimState.AttachPythonInterface(pythonInterface); - mcSimState.AttachSound(&mcSound); mcSimState.AttachUserInfo(&mcUserInfo); mcSimState.AttachCommandInterface(&mcCommandQueue); --- 851,854 ---- *************** *** 883,887 **** wxASSERT(director); pythonInterface->AttachConsole(infoConsole); - pythonInterface->AttachSound(&mcSound); pythonInterface->AttachSensorMap(mcSimState.mcSensorMap.GetMap(mcUserInfo.GetOwnAlliance())); pythonInterface->AttachCommandQueue(&mcCommandQueue); --- 863,866 ---- *************** *** 896,900 **** viewer->AttachMapData(&mcMapData); ! //mcSound.PlayEffect(SEFFECT_WELCOME); return true; --- 875,879 ---- viewer->AttachMapData(&mcMapData); ! //tcSound::Get()->PlayEffect(SEFFECT_WELCOME); return true; *************** *** 1038,1042 **** tcTime::Update(); ! networkInterface->Update(); startView->mbPlayEnabled = mcSimState.msScenarioInfo.mbLoaded; --- 1017,1021 ---- tcTime::Update(); ! tcMultiplayerInterface::Get().Update(); startView->mbPlayEnabled = mcSimState.msScenarioInfo.mbLoaded; *************** *** 1083,1087 **** viewer->Frame(); ! mcSound.UpdateAutoMusic(0); #if 0 --- 1062,1066 ---- viewer->Frame(); ! tcSound::Get()->UpdateAutoMusic(0); #if 0 *************** *** 1335,1343 **** if(mcOptions.mbPlayMusic) { ! mcSound.UpdateAutoMusic(gameTime); } else { ! mcSound.StopMusic(); } --- 1314,1322 ---- if(mcOptions.mbPlayMusic) { ! tcSound::Get()->UpdateAutoMusic(gameTime); } else { ! tcSound::Get()->StopMusic(); } *************** *** 1408,1417 **** } ! if (networkInterface) ! { ! delete networkInterface; ! } ! ! mcSound.UnInit(); tcCustomControl::ReleaseGdi(); --- 1387,1391 ---- } ! tcSound::Get()->UnInit(); tcCustomControl::ReleaseGdi(); *************** *** 1518,1522 **** if (nHookID != NULL_INDEX) { ! mcSound.PlayEffect(SEFFECT_SHORTBEEP); pythonInterface->SetMenuPlatform(nHookID); } --- 1492,1496 ---- if (nHookID != NULL_INDEX) { ! tcSound::Get()->PlayEffect(SEFFECT_SHORTBEEP); pythonInterface->SetMenuPlatform(nHookID); } *************** *** 1837,1841 **** SetRect(&marectButtonBar[0],mrectConsole.right - 100,nY-25,mrectConsole.right,nY); maButtonBar[0].SetWindow(marectButtonBar[0]); - maButtonBar[0].AttachSound(&mcSound); maButtonBar[0].ClearButtons(); maButtonBar[0].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","Norm"); --- 1811,1814 ---- *************** *** 1850,1854 **** SetRect(&marectButtonBar[1],mrectConsole.right - 200,nY-25,mrectConsole.right,nY); maButtonBar[1].SetWindow(marectButtonBar[1]); - maButtonBar[1].AttachSound(&mcSound); maButtonBar[1].ClearButtons(); maButtonBar[1].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","NTDS"); --- 1823,1826 ---- *************** *** 1863,1867 **** SetRect(&marectButtonBar[2],mrectConsole.right - 350,nY-25,mrectConsole.right,nY); maButtonBar[2].SetWindow(marectButtonBar[2]); - maButtonBar[2].AttachSound(&mcSound); maButtonBar[2].ClearButtons(); maButtonBar[2].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","Small"); --- 1835,1838 ---- *************** *** 1877,1881 **** SetRect(&marectButtonBar[3],20, mrectOOB.top + 20, 0, 0); maButtonBar[3].SetWindow(marectButtonBar[3]); - maButtonBar[3].AttachSound(&mcSound); maButtonBar[3].ClearButtons(); maButtonBar[3].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","OOB"); --- 1848,1851 ---- *************** *** 2081,2085 **** else { if (mcSimState.DesignateLauncherTarget(tacticalMap->mnHookID,anData,snData2)==false) { ! mcSound.PlayEffect(SEFFECT_REJECTBEEP); // failed, repeat command ProcessCommand(PC_GETLAUNCHERTARGET,0,0,anData); --- 2051,2055 ---- else { if (mcSimState.DesignateLauncherTarget(tacticalMap->mnHookID,anData,snData2)==false) { ! tcSound::Get()->PlayEffect(SEFFECT_REJECTBEEP); // failed, repeat command ProcessCommand(PC_GETLAUNCHERTARGET,0,0,anData); *************** *** 2091,2095 **** WTL("tcGame::ProcessCommand PC_GETDATUM"); tacticalMap->ActivateCmd(MC_DATUM); ! //mcSound.PlayEffect(SEFFECT_TWOBEEPS); seMode = PLATFORM_DATUM; break; --- 2061,2065 ---- WTL("tcGame::ProcessCommand PC_GETDATUM"); tacticalMap->ActivateCmd(MC_DATUM); ! //tcSound::Get()->PlayEffect(SEFFECT_TWOBEEPS); seMode = PLATFORM_DATUM; break; *************** *** 2097,2101 **** WTL("tcGame::ProcessCommand PC_GETLAUNCHERDATUM"); tacticalMap->ActivateCmd(MC_DATUM); ! //mcSound.PlayEffect(SEFFECT_TWOBEEPS); seMode = LAUNCHER_DATUM; break; --- 2067,2071 ---- WTL("tcGame::ProcessCommand PC_GETLAUNCHERDATUM"); tacticalMap->ActivateCmd(MC_DATUM); ! //tcSound::Get()->PlayEffect(SEFFECT_TWOBEEPS); seMode = LAUNCHER_DATUM; break; *************** *** 2131,2135 **** } else { ! mcSound.PlayEffect(SEFFECT_REJECTBEEP); infoConsole->Print("No launchers ready to fire"); } --- 2101,2105 ---- } else { ! tcSound::Get()->PlayEffect(SEFFECT_REJECTBEEP); infoConsole->Print("No launchers ready to fire"); } Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCreditView.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcCreditView.cpp 29 Jan 2004 00:05:38 -0000 1.8 --- tcCreditView.cpp 29 Feb 2004 22:51:36 -0000 1.9 *************** *** 231,240 **** } ! if (bFlash) { if (nFlashId >= 0) {szFocus = maCredit[nFlashId].mzCaption;} snFocusTime = mcTime.snCount_30Hz; mpBrush->SetColor(Color(255,255,255,255)); pGraphics->FillRectangle(mpBrush,0,0,mnWidth,mnHeight); ! mpSound->PlayEffect(SEFFECT_EXPLOSION2); } if (nFlashId >= 0) { --- 231,241 ---- } ! if (bFlash) ! { if (nFlashId >= 0) {szFocus = maCredit[nFlashId].mzCaption;} snFocusTime = mcTime.snCount_30Hz; mpBrush->SetColor(Color(255,255,255,255)); pGraphics->FillRectangle(mpBrush,0,0,mnWidth,mnHeight); ! tcSound::Get()->PlayEffect(SEFFECT_EXPLOSION2); } if (nFlashId >= 0) { *************** *** 330,334 **** mpFontSmall = NULL; mpBrush = NULL; - mpSound = NULL; mnCredits = 0; mbDrawRewind = false; --- 331,334 ---- Index: tcDirector.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcDirector.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcDirector.cpp 1 Jan 2004 23:44:47 -0000 1.5 --- tcDirector.cpp 29 Feb 2004 22:51:36 -0000 1.6 *************** *** 107,115 **** } ! tcDirector::tcDirector(tc3DViewer *view3D, tcMapView *mv, tcSound *soundInterface, tcConsole *console , wxWindow *win) : mapView(mv), viewer(view3D) { - tcSoundEvent::AttachSound(soundInterface); tcConsoleTextEvent::AttachConsole(console); tcDirectorEvent::AttachEventHandler(win); --- 107,114 ---- } ! tcDirector::tcDirector(tc3DViewer *view3D, tcMapView *mv, tcConsole *console , wxWindow *win) : mapView(mv), viewer(view3D) { tcConsoleTextEvent::AttachConsole(console); tcDirectorEvent::AttachEventHandler(win); Index: tcDirectorEvent.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcDirectorEvent.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcDirectorEvent.cpp 3 Jan 2004 00:45:13 -0000 1.5 --- tcDirectorEvent.cpp 29 Feb 2004 22:51:36 -0000 1.6 *************** *** 139,143 **** /********************** tcSoundEvent ***************************/ - tcSound* tcSoundEvent::soundInterface = NULL; void tcSoundEvent::Update(double t) --- 139,142 ---- *************** *** 159,163 **** void tcSoundEffectEvent::Update(double t) { - wxASSERT(soundInterface); if (t < eventStart) { --- 158,161 ---- *************** *** 166,170 **** } if (triggered) return; ! soundInterface->PlayEffect(effectCode); triggered = true; } --- 164,168 ---- } if (triggered) return; ! tcSound::Get()->PlayEffect(effectCode); triggered = true; } *************** *** 189,210 **** if (command == "play") { ! soundInterface->PlayMusic(song); ! soundInterface->SeekMusic(param); } else if (command == "pause") { ! soundInterface->SetMusicPause(true); } else if (command == "unpause") { ! soundInterface->SetMusicPause(false); } else if (command == "seek") { ! soundInterface->SeekMusic(param); } else if (command == "volume") { ! soundInterface->SetMusicVolume(param); } triggered = true; --- 187,208 ---- if (command == "play") { ! tcSound::Get()->PlayMusic(song); ! tcSound::Get()->SeekMusic(param); } else if (command == "pause") { ! tcSound::Get()->SetMusicPause(true); } else if (command == "unpause") { ! tcSound::Get()->SetMusicPause(false); } else if (command == "seek") { ! tcSound::Get()->SeekMusic(param); } else if (command == "volume") { ! tcSound::Get()->SetMusicVolume(param); } triggered = true; Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcMapView.cpp 1 Feb 2004 22:19:09 -0000 1.18 --- tcMapView.cpp 29 Feb 2004 22:51:36 -0000 1.19 *************** *** 266,270 **** mpMapData = NULL; mpOptions = NULL; - mpSound = NULL; mnXCenter = 0; --- 266,269 ---- *************** *** 1497,1501 **** { SetViewCenterZoom(point,1.5f); ! if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);} return; } --- 1496,1500 ---- { SetViewCenterZoom(point,1.5f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; } *************** *** 1503,1507 **** { SetViewCenterZoom(point,1.0f); ! if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);} return; } --- 1502,1506 ---- { SetViewCenterZoom(point,1.0f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; } *************** *** 1530,1534 **** { SetViewCenterZoom(point,0.7f); ! if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);} return; // old returned true } --- 1529,1533 ---- { SetViewCenterZoom(point,0.7f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; // old returned true } *************** *** 1584,1593 **** { SetViewCenterZoom(point,2.0f); ! if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);} } else if (zDelta < 0) { SetViewCenterZoom(point,0.5f); ! if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);} } } --- 1583,1592 ---- { SetViewCenterZoom(point,2.0f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else if (zDelta < 0) { SetViewCenterZoom(point,0.5f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } } *************** *** 1805,1809 **** { SetViewCenterZoom(point,2.0f); ! if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);} } } --- 1804,1808 ---- { SetViewCenterZoom(point,2.0f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } } *************** *** 1811,1815 **** { SetViewCenterZoom(point,1.0f); ! if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);} } else --- 1810,1814 ---- { SetViewCenterZoom(point,1.0f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else *************** *** 1824,1828 **** { SetViewCenterZoom(point,0.5f); ! if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);} } } --- 1823,1827 ---- { SetViewCenterZoom(point,0.5f); ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } } Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcNetworkView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcNetworkView.cpp 27 Feb 2004 00:07:59 -0000 1.3 --- tcNetworkView.cpp 29 Feb 2004 22:51:36 -0000 1.4 *************** *** 32,36 **** #include "tcEditBox.h" #include "tcXMLFile.h" ! #include "network/tcNetworkInterface.h" #include "wxcommands.h" --- 32,36 ---- #include "tcEditBox.h" #include "tcXMLFile.h" ! #include "network/tcMultiplayerInterface.h" #include "wxcommands.h" *************** *** 40,43 **** --- 40,44 ---- EVT_COMMAND(ID_MULTIPLAYERMODE, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetNetworkMode) EVT_COMMAND(ID_CONNECT, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::OnConnect) + EVT_COMMAND(ID_CHATTEXT, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SendChatText) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetIPText) END_EVENT_TABLE() *************** *** 47,50 **** --- 48,53 ---- #endif + using network::tcMultiplayerInterface; + int tcNetworkView::Draw() { *************** *** 79,88 **** DrawTextCenteredHV(graphics, font12, mpBrush, "Connection Status", x, y); ! unsigned nConnections = networkInterface->GetNumConnections(); x = (float)statusBoxBounds.x + 10.0f; for (unsigned n=0;n<nConnections;n++) { y += 10.0f; ! std::string connectionStatus = networkInterface->GetConnectionStatus(n); DrawText(graphics, font8, mpBrush, connectionStatus.c_str(), x, y); --- 82,91 ---- DrawTextCenteredHV(graphics, font12, mpBrush, "Connection Status", x, y); ! unsigned nConnections = tcMultiplayerInterface::Get().GetNumConnections(); x = (float)statusBoxBounds.x + 10.0f; for (unsigned n=0;n<nConnections;n++) { y += 10.0f; ! std::string connectionStatus = tcMultiplayerInterface::Get().GetConnectionStatus(n); DrawText(graphics, font8, mpBrush, connectionStatus.c_str(), x, y); *************** *** 97,101 **** if (networkMode != 1) return; ! networkInterface->OpenConnection(ipText.c_str()); } --- 100,104 ---- if (networkMode != 1) return; ! tcMultiplayerInterface::Get().OpenConnection(ipText.c_str()); } *************** *** 104,107 **** --- 107,127 ---- } + /** + * Send chat text to all connections + */ + void tcNetworkView::SendChatText(wxCommandEvent& event) + { + std::string chatText = "This is some test chat text."; + + unsigned nConnections = tcMultiplayerInterface::Get().GetNumConnections(); + + for (unsigned n=0;n<nConnections;n++) + { + int connId = tcMultiplayerInterface::Get().GetConnectionId(n); + tcMultiplayerInterface::Get().SendTestMessage(connId, chatText); + } + + } + void tcNetworkView::SetIPText(wxCommandEvent& event) { *************** *** 118,130 **** if (mode <= 1) { ! networkInterface->MakeClient(); } else if (mode == 2) { ! networkInterface->MakeServer(); } ! //networkInterface->OpenConnection("192.168.0.101"); networkMode = mode; --- 138,150 ---- if (mode <= 1) { ! tcMultiplayerInterface::Get().MakeClient(); } else if (mode == 2) { ! tcMultiplayerInterface::Get().MakeServer(); } ! //tcMultiplayerInterface::Get().OpenConnection("192.168.0.101"); networkMode = mode; *************** *** 137,141 **** const wxPoint& pos, const wxSize& size, const wxString& name) : tcStandardWindow(parent, pos, size, "xml/network_view.xml", name), - networkInterface(NULL), networkMode(0) { --- 157,160 ---- Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcOOBView.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcOOBView.cpp 18 Jan 2004 18:42:41 -0000 1.5 --- tcOOBView.cpp 29 Feb 2004 22:51:36 -0000 1.6 *************** *** 278,285 **** } mnSelectedKey = new_key; ! if (mpSound != NULL) ! { ! mpSound->PlayEffect(SEFFECT_SHORTBEEP); ! } mbMouseDrag = true; msFormationChangeInfo.mnFollowerKey = pInfo->mnID; --- 278,284 ---- } mnSelectedKey = new_key; ! ! tcSound::Get()->PlayEffect(SEFFECT_SHORTBEEP); ! mbMouseDrag = true; msFormationChangeInfo.mnFollowerKey = pInfo->mnID; *************** *** 302,308 **** msFormationChangeInfo.mnNewLeaderKey = pInfo->mnID; msFormationChangeInfo.mbApply = true; ! if (mpSound != NULL) { ! mpSound->PlayEffect(SEFFECT_BEEP2); ! } } } --- 301,306 ---- msFormationChangeInfo.mnNewLeaderKey = pInfo->mnID; msFormationChangeInfo.mbApply = true; ! ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } } *************** *** 329,333 **** mpSimState = NULL; mpMapView = NULL; - mpSound = NULL; mnCount = 0; mnAlliance = 0; --- 327,330 ---- Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcObjectControl.cpp 13 Feb 2004 01:31:33 -0000 1.13 --- tcObjectControl.cpp 29 Feb 2004 22:51:36 -0000 1.14 *************** *** 1156,1162 **** } bool bAccepted = ProcessWeaponPanelButton(nLauncher,nCol); ! if ((mpSound != NULL)&&(bAccepted)) { ! mpSound->PlayEffect(SEFFECT_LOWBEEP); } } --- 1156,1162 ---- } bool bAccepted = ProcessWeaponPanelButton(nLauncher,nCol); ! if (bAccepted) { ! tcSound::Get()->PlayEffect(SEFFECT_LOWBEEP); } } *************** *** 1169,1175 **** } bool bAccepted = ProcessSensorPanelButton(nSensor,nCol); ! if ((mpSound != NULL)&&(bAccepted)) { ! mpSound->PlayEffect(SEFFECT_PING3); } } --- 1169,1175 ---- } bool bAccepted = ProcessSensorPanelButton(nSensor,nCol); ! if (bAccepted) { ! tcSound::Get()->PlayEffect(SEFFECT_PING3); } } *************** *** 1262,1266 **** else { ! //mpSound->PlayEffect(SEFFECT_REJECTBEEP); } return true; --- 1262,1266 ---- else { ! //tcSound::Get()->PlayEffect(SEFFECT_REJECTBEEP); } return true; *************** *** 1542,1546 **** mnLaunchers = 0; mpHookedGameObj = NULL; - mpSound = NULL; mpCommandInterface = NULL; mpUserInfo = NULL; --- 1542,1545 ---- Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcRadar.cpp 13 Feb 2004 01:31:33 -0000 1.4 --- tcRadar.cpp 29 Feb 2004 22:51:36 -0000 1.5 *************** *** 384,388 **** if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) { ! simState->mpSound->PlayEffect(SEFFECT_PING); } char zBuff[128]; --- 384,388 ---- if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_PING); } char zBuff[128]; *************** *** 436,440 **** if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) { ! simState->mpSound->PlayEffect(SEFFECT_TWOBEEPS); } } --- 436,440 ---- if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_TWOBEEPS); } } Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcScenarioSelectView.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcScenarioSelectView.cpp 1 Jan 2004 23:44:47 -0000 1.12 --- tcScenarioSelectView.cpp 29 Feb 2004 22:51:36 -0000 1.13 *************** *** 246,274 **** if (mrectReturnButton.Contains((REAL)point.x,(REAL)point.y)) { if (mnReturnButtonState == 0) { ! mpSound->PlayEffect(SEFFECT_THUCK); mnReturnButtonState = 1; } } ! else { if (mnReturnButtonState != 2) {mnReturnButtonState = 0;} } ! if (bButtonOver) { ! if (nButton >= mnButtons) { WTL("tcScenarioSelectView::OnMouseMove error"); return; } ! if (mpSound != NULL) { ! //mpSound->PlayEffect(SEFFECT_BEEP2); ! } } ! for(unsigned i=0;i<mnButtons;i++) { ! if ((i == nButton)&&(bButtonOver)) { ! if ((maButton[i].mnState == 0)) { ! mpSound->PlayEffect(SEFFECT_THUCK); maButton[i].mnState = 1; } } ! else { if (maButton[i].mnState == 1) {maButton[i].mnState = 0;} } --- 246,280 ---- if (mrectReturnButton.Contains((REAL)point.x,(REAL)point.y)) { if (mnReturnButtonState == 0) { ! tcSound::Get()->PlayEffect(SEFFECT_THUCK); mnReturnButtonState = 1; } } ! else ! { if (mnReturnButtonState != 2) {mnReturnButtonState = 0;} } ! if (bButtonOver) ! { ! if (nButton >= mnButtons) ! { WTL("tcScenarioSelectView::OnMouseMove error"); return; } ! ! //tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } ! for(unsigned i=0;i<mnButtons;i++) ! { ! if ((i == nButton)&&(bButtonOver)) ! { ! if ((maButton[i].mnState == 0)) ! { ! tcSound::Get()->PlayEffect(SEFFECT_THUCK); maButton[i].mnState = 1; } } ! else ! { if (maButton[i].mnState == 1) {maButton[i].mnState = 0;} } *************** *** 329,336 **** if (maButton[i].mnState != 2) { ! if ((mpSound != NULL)) ! { ! mpSound->PlayEffect(SEFFECT_BEEP2); ! } if (maButton[i].mbLoadRandom) { --- 335,339 ---- if (maButton[i].mnState != 2) { ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); if (maButton[i].mbLoadRandom) { *************** *** 495,499 **** mpFont = NULL; mpBrush = NULL; - mpSound = NULL; mpSimState = NULL; mnXStart = 100; --- 498,501 ---- Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcSimState.cpp 15 Feb 2004 19:47:23 -0000 1.34 --- tcSimState.cpp 29 Feb 2004 22:51:36 -0000 1.35 *************** *** 200,205 **** if (pLauncherState->GetLauncherStatus(anLauncher) == tcLauncherState::LAUNCHER_READY) { ! if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { ! mpSound->PlayEffect(SEFFECT_NOISYBEEP); } return true; --- 200,206 ---- if (pLauncherState->GetLauncherStatus(anLauncher) == tcLauncherState::LAUNCHER_READY) { ! if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) ! { ! tcSound::Get()->PlayEffect(SEFFECT_NOISYBEEP); } return true; *************** *** 233,237 **** pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { ! mpSound->PlayEffect(SEFFECT_NOISYBEEP); } return true; --- 234,238 ---- pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_NOISYBEEP); } return true; *************** *** 239,243 **** else { //pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); ! //mpSound->PlayEffect(SEFFECT_LOWBEEP); return false; } --- 240,244 ---- else { //pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); ! //tcSound::Get()->PlayEffect(SEFFECT_LOWBEEP); return false; } *************** *** 346,354 **** if (mpUserInfo->IsOwnAlliance(ptarget->mnAlliance)) { ! mpSound->PlayEffect(SEFFECT_IMPLOSION); } else { ! mpSound->PlayEffect(SEFFECT_EXPLOSION2); } } --- 347,355 ---- if (mpUserInfo->IsOwnAlliance(ptarget->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_IMPLOSION); } else { ! tcSound::Get()->PlayEffect(SEFFECT_EXPLOSION2); } } *************** *** 745,749 **** if (mpUserInfo->IsOwnAlliance(apRadarPlat->mnAlliance)) { ! mpSound->PlayEffect(SEFFECT_PING); } char zBuff[128]; --- 746,750 ---- if (mpUserInfo->IsOwnAlliance(apRadarPlat->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_PING); } char zBuff[128]; *************** *** 850,856 **** ! if (bNewDetection) { pSMTrack->UpdateTrack(); ! if (mpUserInfo->IsOwnAlliance(apESMPlat->mnAlliance)) {mpSound->PlayEffect(SEFFECT_PING);} char zBuff[128]; sprintf(zBuff,"target %d detected with ESM at %3.1f deg at time %.1f [a:%d]", --- 851,861 ---- ! if (bNewDetection) ! { pSMTrack->UpdateTrack(); ! if (mpUserInfo->IsOwnAlliance(apESMPlat->mnAlliance)) ! { ! tcSound::Get()->PlayEffect(SEFFECT_PING); ! } char zBuff[128]; sprintf(zBuff,"target %d detected with ESM at %3.1f deg at time %.1f [a:%d]", *************** *** 1044,1048 **** { gameObj->toLaunch.clear(); ! mpSound->PlayEffect(SEFFECT_JETLAUNCH); } } --- 1049,1053 ---- { gameObj->toLaunch.clear(); ! tcSound::Get()->PlayEffect(SEFFECT_JETLAUNCH); } } *************** *** 1094,1099 **** if (apRadarSS->mnMode == SSMODE_SEEKERACQUIRE) { apRadarSS->mnMode=SSMODE_SEEKERTRACK; ! if(mpUserInfo->IsOwnAlliance(applat->mnAlliance)) { ! mpSound->PlayEffect(SEFFECT_TWOBEEPS); } } --- 1099,1105 ---- if (apRadarSS->mnMode == SSMODE_SEEKERACQUIRE) { apRadarSS->mnMode=SSMODE_SEEKERTRACK; ! if(mpUserInfo->IsOwnAlliance(applat->mnAlliance)) ! { ! tcSound::Get()->PlayEffect(SEFFECT_TWOBEEPS); } } *************** *** 1230,1234 **** if (mpUserInfo->IsOwnAlliance(plaunchingplatform->mnAlliance)) { ! mpSound->PlayEffect(SEFFECT_MISSILELAUNCH); } --- 1236,1240 ---- if (mpUserInfo->IsOwnAlliance(plaunchingplatform->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_MISSILELAUNCH); } *************** *** 1784,1788 **** mpMapData = NULL; mpPythonInterface = NULL; - mpSound = NULL; mpUserInfo = NULL; mfSimTime = 0; --- 1790,1793 ---- Index: tcStartView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcStartView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcStartView.cpp 20 Feb 2004 03:31:50 -0000 1.9 --- tcStartView.cpp 29 Feb 2004 22:51:36 -0000 1.10 *************** *** 210,218 **** return; } ! if (mpSound != NULL) ! { ! //mpSound->PlayEffect(SEFFECT_BEEP2); ! } ! } --- 210,214 ---- return; } ! //tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } *************** *** 224,228 **** if ((maButton[i].mnState == 0)&&(bButtonEnabled)) { ! mpSound->PlayEffect(SEFFECT_THUCK); } if (bButtonEnabled) {maButton[i].mnState = 1;} --- 220,224 ---- if ((maButton[i].mnState == 0)&&(bButtonEnabled)) { ! tcSound::Get()->PlayEffect(SEFFECT_THUCK); } if (bButtonEnabled) {maButton[i].mnState = 1;} *************** *** 258,264 **** } ! if ((mpSound != NULL)&&(nButton != 2)) { ! mpSound->PlayEffect(SEFFECT_BEEP2); } int command_id; --- 254,260 ---- } ! if (nButton != 2) { ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } int command_id; *************** *** 399,403 **** mpFont = NULL; mpBrush = NULL; - mpSound = NULL; for (int i=0; i < N_START_BUTTONS; i++) --- 395,398 ---- |
|
From: <ddc...@us...> - 2004-02-29 23:02:10
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13290/src/network Modified Files: tcNetworkInterface.cpp Added Files: tcConnectionData.cpp tcMessage.cpp tcMultiplayerInterface.cpp Log Message: --- NEW FILE: tcConnectionData.cpp --- /** @file tcConnectionData.cpp */ /* ** ** Copyright (C) 2003-2004 Dewitt "Cole" 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 #include "network/tcConnectionData.h" #include "network/tcNetworkInterface.h" #include "tcTime.h" #include <iostream> BEGIN_NAMESPACE(network) tcNetworkInterface* tcConnectionData::networkInterface = NULL; /** * Attempts to read next whole message. If message is incomplete, the partial * message is returned to the socket read buffer. This method does not block. * Uses tempMessage for temporary storage. If return message is to be stored, * the message must be COPIED. Do not store the pointer. * @return pointer to new message if entire message is ready, otherwise NULL */ tcMessage* tcConnectionData::ReadNextMessage() { wxASSERT(socket); // attempt to read header if header needs to be read if (tempMessage.id == -1) { const unsigned headerSize = sizeof(tempMessage.messageSize) + sizeof(tempMessage.id); // verify the message header and at least one byte of data are available socket->Read(tempMessage.buffer + tempMessage.bufferIdx, headerSize - tempMessage.bufferIdx); tempMessage.bufferIdx += socket->LastCount(); if (tempMessage.bufferIdx >= headerSize) { memcpy(&tempMessage.messageSize, tempMessage.buffer, sizeof(tempMessage.messageSize)); memcpy(&tempMessage.id, tempMessage.buffer + sizeof(tempMessage.messageSize), sizeof(tempMessage.id)); tempMessage.bufferIdx = 0; } } if (tempMessage.id == -1) return NULL; // Read message socket->Read(tempMessage.buffer + tempMessage.bufferIdx, tempMessage.messageSize - tempMessage.bufferIdx); tempMessage.bufferIdx += socket->LastCount(); if (tempMessage.bufferIdx >= tempMessage.messageSize) { tempMessage.bufferIdx = 0; // reset bufferIdx } else { fprintf(stdout, "Read %d bytes of data\n", tempMessage.bufferIdx); return NULL; } //socket->SetFlags(wxSOCKET_NOWAIT); tempMessage.buffer[256] = 0; std::string testString; testString = (char*)tempMessage.buffer; fprintf(stdout, "Received message, size: %d, id:%d, data:%s\n", tempMessage.messageSize, tempMessage.id, testString.c_str()); wxMessageBox(testString.c_str(),"Message",wxOK); tempMessage.Reset(); return &tempMessage; } /** * Adds message idx to back of TCP send queue */ void tcConnectionData::SendTCP(unsigned int idx) { writeQueueTCP.push(idx); } /** * */ void tcConnectionData::Update() { wxASSERT(networkInterface); //ReadNextMessage(); WriteQueuedMessage(); } /** * Writes next queued message to socket. If capacity of write buffer * is exceeded, writes part of the message only. */ void tcConnectionData::WriteQueuedMessage() { if (writeQueueTCP.empty()) return; int bufferId = writeQueueTCP.front(); tcMessage *message = networkInterface->GetMessage(bufferId); if (message == NULL) { std::cerr << "Error - bad message buffer idx." << std::endl; writeQueueTCP.pop(); return; } // socket->SetFlags(wxSOCKET_WAITALL); const unsigned idx1 = sizeof(message->messageSize); const unsigned idx2 = sizeof(message->messageSize) + sizeof(message->id); if (message->bufferIdx < idx1) { // write message size field socket->Write(&message->messageSize + message->bufferIdx, idx1 - message->bufferIdx); message->bufferIdx += socket->LastCount(); if (message->bufferIdx < idx1) return; } if (socket->Error()) { int gg = 4; wxSocketError err = socket->LastError(); } if (message->bufferIdx < idx2) { // write message id field socket->Write(&message->id + message->bufferIdx - idx1, idx2 - message->bufferIdx); message->bufferIdx += socket->LastCount(); if (message->bufferIdx < idx2) return; } if (socket->Error()) { int gg = 4; wxSocketError err = socket->LastError(); } // write data socket->Write(&message->buffer[message->bufferIdx - idx2], message->messageSize - message->bufferIdx + idx2); message->bufferIdx += socket->LastCount(); // pop message from queue and return message buffer if entire // message has been written if (message->bufferIdx >= (message->messageSize + idx2)) { writeQueueTCP.pop(); networkInterface->ReturnMessage(bufferId); } if (socket->Error()) { int gg = 4; wxSocketError err = socket->LastError(); } // socket->SetFlags(wxSOCKET_NOWAIT); } /** * tcConnectionData default constructor */ tcConnectionData::tcConnectionData() { socket = NULL; idString = "Err"; id = -1; } END_NAMESPACE --- NEW FILE: tcMessage.cpp --- /** @file tcMessage.cpp */ /* ** ** Copyright (C) 2003-2004 Dewitt "Cole" 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 #include "network/tcMessage.h" #include <iostream> BEGIN_NAMESPACE(network) /** * Reset message state to default / uninitialized */ void tcMessage::Reset() { id = -1; sourceId = -1; timestamp = 0; bufferIdx = 0; messageSize = 0; } /** * tcMessage default constructor */ tcMessage::tcMessage() { Reset(); } /** * copy constructor */ tcMessage::tcMessage(const tcMessage& source) { id = source.id;; timestamp = source.timestamp; sourceId = source.sourceId; bufferIdx = source.bufferIdx; messageSize = source.messageSize; wxASSERT(messageSize <= BUFFER_SIZE); if (messageSize > BUFFER_SIZE) messageSize = BUFFER_SIZE; memcpy(buffer, source.buffer, messageSize); } END_NAMESPACE --- NEW FILE: tcMultiplayerInterface.cpp --- /** @file tcNetworkInterface.cpp */ /** tcMultiplayerInterface.cpp */ /* ** Copyright (C) 2003 Dewitt "Cole" 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 #include "network/tcNetworkInterface.h" #include "network/tcMultiplayerInterface.h" BEGIN_NAMESPACE(network) /** * @return singleton instance */ tcMultiplayerInterface& tcMultiplayerInterface::Get() { static tcMultiplayerInterface instance; return instance; } int tcMultiplayerInterface::GetConnectionId(unsigned connectionIdx) { return networkInterface->GetConnectionId(connectionIdx); } std::string tcMultiplayerInterface::GetConnectionStatus(unsigned connectionIdx) { return networkInterface->GetConnectionStatus(connectionIdx); } unsigned tcMultiplayerInterface::GetNumConnections() { return networkInterface->GetNumConnections(); } void tcMultiplayerInterface::MakeClient() { networkInterface->MakeClient(); } void tcMultiplayerInterface::MakeServer() { networkInterface->MakeServer(); } void tcMultiplayerInterface::OpenConnection(std::string hostName) { networkInterface->OpenConnection(hostName.c_str()); } /** * Sends a test message of text to destination */ void tcMultiplayerInterface::SendTestMessage(int destination, std::string message) { char buff[256]; size_t messageLength = message.length(); if (messageLength > 255) messageLength = 255; strncpy(buff, message.c_str(), messageLength); buff[messageLength] = 0; networkInterface->SendMessage(destination, 1, (unsigned)(messageLength+1), (unsigned char*)buff); } /** * This must be called regularly to perform network functions. * (avoids need for multithreadeding) */ void tcMultiplayerInterface::Update() { networkInterface->Update(); } tcMultiplayerInterface::tcMultiplayerInterface() { networkInterface = new tcNetworkInterface(); wxASSERT(networkInterface); } /** * Copy constructor not allowed for this singleton class */ tcMultiplayerInterface::tcMultiplayerInterface(const tcMultiplayerInterface& source) { wxASSERT(false); } tcMultiplayerInterface::~tcMultiplayerInterface() { if (networkInterface) delete networkInterface; } END_NAMESPACE Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcNetworkInterface.cpp 27 Feb 2004 00:07:59 -0000 1.3 --- tcNetworkInterface.cpp 29 Feb 2004 22:51:36 -0000 1.4 *************** *** 23,27 **** #ifndef WX_PRECOMP #include "wx/wx.h" - //#include "wx/msw/private.h" // for MS Windows specific definitions #endif --- 23,26 ---- *************** *** 32,77 **** BEGIN_NAMESPACE(network) ! /** ! * Reset message state to default / uninitialized ! */ ! void tcNetworkInterface::tcMessage::Reset() ! { ! id = -1; ! timestamp = 0; ! messageId = -1; ! messageSize = 0; ! } - /** - * tcMessage default constructor - */ - tcNetworkInterface::tcMessage::tcMessage() - { - Reset(); - } - /** - * copy constructor - */ - tcNetworkInterface::tcMessage::tcMessage(const tcNetworkInterface::tcMessage& source) - { - id = source.id;; - timestamp = source.timestamp; - messageId = source.messageId; - messageSize = source.messageSize; - wxASSERT(messageSize <= BUFFER_SIZE); - if (messageSize > BUFFER_SIZE) messageSize = BUFFER_SIZE; - memcpy(buffer, source.buffer, messageSize); - } - - /** - * tcConnectionData default constructor - */ - tcNetworkInterface::tcConnectionData::tcConnectionData() - { - socket = NULL; - idString = "Err"; - id = -1; - } void tcNetworkInterface::AddConnection(wxSocketBase *socket) --- 31,39 ---- BEGIN_NAMESPACE(network) ! BEGIN_EVENT_TABLE(tcNetworkInterface, wxEvtHandler) ! EVT_SOCKET(-1, tcNetworkInterface::OnSocketEvent) ! END_EVENT_TABLE() void tcNetworkInterface::AddConnection(wxSocketBase *socket) *************** *** 95,104 **** cdata.id = connectionIndex++; - connectionLookup[cdata.id] = (int)connectionData.size(); ! socket->Notify(FALSE); connectionData.push_back(cdata); fprintf(stdout, "New connection: %s : %d\n", addr.Hostname().c_str(), addr.Service()); --- 57,69 ---- cdata.id = connectionIndex++; ! socket->SetEventHandler(*this, cdata.id); ! socket->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_CONNECTION_FLAG); ! socket->Notify(TRUE); ! socket->SetFlags(wxSOCKET_NOWAIT); connectionData.push_back(cdata); + UpdateConnectionLookup(); fprintf(stdout, "New connection: %s : %d\n", addr.Hostname().c_str(), addr.Service()); *************** *** 216,228 **** /** * Obtains message buffer if available. ! * @param idx index of new message buffer ! * @return true if message buffer is available */ ! bool tcNetworkInterface::GetMessage(unsigned int& idx) { ! if (available.empty()) return false; ! idx = available.front(); available.pop(); ! return true; } --- 181,208 ---- /** * Obtains message buffer if available. ! * @return valid id if message buffer is available, -1 otherwise */ ! int tcNetworkInterface::CheckoutMessage() { ! if (available.empty()) return -1; ! int idx = (int)available.front(); available.pop(); ! return idx; ! } ! ! /** ! * @return NULL if idx is invalid, pointer to connection data otherwise ! */ ! tcConnectionData* tcNetworkInterface::GetConnection(int idx) ! { ! if (idx < 0) return NULL; ! if (idx >= (int)connectionData.size()) return NULL; ! return &connectionData[idx]; ! } ! ! tcMessage* tcNetworkInterface::GetMessage(int id) ! { ! if ((id < 0)||(id >= (int)messageBuffer.size())) return NULL; ! return &messageBuffer[id]; } *************** *** 307,311 **** } ! serverSock->Notify(FALSE); } --- 287,326 ---- } ! serverSock->SetEventHandler(*this, 27); ! serverSock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_CONNECTION_FLAG); ! serverSock->Notify(TRUE); ! //serverSock->Notify(FALSE); ! serverSock->SetFlags(wxSOCKET_NOWAIT); ! } ! ! void tcNetworkInterface::OnSocketEvent(wxSocketEvent& event) ! { ! std::cout << "Socket event: "; ! ! switch(event.GetSocketEvent()) ! { ! case wxSOCKET_INPUT: ! { ! std::cout << "wxSOCKET_INPUT"; ! int connectionIdx = LookupConnectionIndex(event.m_id); ! tcConnectionData *conn = GetConnection(connectionIdx); ! if (conn) ! { ! conn->ReadNextMessage(); ! } ! ! } ! break; ! case wxSOCKET_LOST: ! std::cout << "wxSOCKET_LOST"; ! break; ! case wxSOCKET_CONNECTION: ! std::cout << "wxSOCKET_CONNECTION"; ! break; ! default: ! std::cout << "Unexpected event!"; ! break; ! } ! std::cout << std::endl; } *************** *** 356,359 **** --- 371,376 ---- void tcNetworkInterface::RemoveDeadConnections() { + bool erasedAny = false; + // update connections, remove dead connections int nConnections = (int)connectionData.size(); *************** *** 366,371 **** if (!connectionData[n].socket->IsConnected()) { - connectionLookup[connectionData[n].id] = -1; // invalidate lookup entry connectionData.erase(connectionData.begin()+n); } } --- 383,388 ---- if (!connectionData[n].socket->IsConnected()) { connectionData.erase(connectionData.begin()+n); + erasedAny = true; } } *************** *** 375,378 **** --- 392,400 ---- connectState = NOT_CONNECTED; } + + if (erasedAny) + { + UpdateConnectionLookup(); + } } *************** *** 386,391 **** size_t nConnections = connectionData.size(); - // iterate in reverse to allow safe removal - // (should substitute iterator for this) for(size_t n=0;n<nConnections;n++) { --- 408,411 ---- *************** *** 424,428 **** ! unsigned char* tcNetworkInterface::GetMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol) { --- 444,448 ---- ! unsigned char* tcNetworkInterface::ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol) { *************** *** 436,440 **** { if (protocol != TCP) return false; // only TCP supported right now ! return false; } --- 456,489 ---- { if (protocol != TCP) return false; // only TCP supported right now ! ! int connectionIdx = LookupConnectionIndex(connectionId); ! if (connectionIdx == -1) ! { ! std::cerr << "Error - Connection id not found." << std::endl; ! return false; ! } ! ! if (messageSize > tcMessage::BUFFER_SIZE) ! { ! std::cerr << "Error - Attempted to send oversized message." << std::endl; ! return false; ! } ! ! // checkout new message ! int bufferIdx = CheckoutMessage(); ! tcMessage *message = GetMessage(bufferIdx); ! if (message == NULL) return false; ! ! // populate message ! message->id = messageId; ! message->messageSize = messageSize; ! message->sourceId = connectionId; ! message->timestamp = tcTime::Get30HzCount(); ! ! memcpy(message->buffer, data, messageSize); ! ! connectionData[connectionIdx].SendTCP(bufferIdx); ! ! return true; } *************** *** 447,450 **** --- 496,503 ---- void tcNetworkInterface::Update() { + static unsigned lastUpdate = tcTime::Get30HzCount(); + + if ((tcTime::Get30HzCount() - lastUpdate) < 15) return; + lastUpdate = tcTime::Get30HzCount(); if (isServer) { *************** *** 471,474 **** --- 524,529 ---- RemoveDeadConnections(); + UpdateConnections(); + } *************** *** 500,503 **** --- 555,583 ---- } + void tcNetworkInterface::UpdateConnections() + { + size_t nConnections = connectionData.size(); + + for(size_t n=0;n<nConnections;n++) + { + connectionData[n].Update(); + } + } + + /** + * Update connectionLookup map (by clearing and rebuilding) + * This should be called after adding or deleting a connection. + */ + void tcNetworkInterface::UpdateConnectionLookup() + { + connectionLookup.clear(); + size_t nConnections = connectionData.size(); + + for(size_t n=0;n<nConnections;n++) + { + connectionLookup[connectionData[n].id] = (int)n; + } + } + void tcNetworkInterface::UpdateServer() { *************** *** 512,515 **** --- 592,596 ---- } + UpdateConnections(); } *************** *** 522,526 **** serverSock(NULL) { ! connectState = NOT_CONNECTED; ResetMessageBuffer(); --- 603,607 ---- serverSock(NULL) { ! tcConnectionData::networkInterface = this; connectState = NOT_CONNECTED; ResetMessageBuffer(); |
|
From: <ddc...@us...> - 2004-02-29 23:02:10
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13290/src/common Modified Files: tcOggStreamer.cpp tcOptions.cpp tcOptionsView.cpp tcSound.cpp tcSoundConsole.cpp Log Message: Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcOggStreamer.cpp 22 Dec 2003 02:32:37 -0000 1.6 --- tcOggStreamer.cpp 29 Feb 2004 22:51:35 -0000 1.7 *************** *** 87,95 **** --- 87,98 ---- void tcOggStreamer::Init() { + std::cout << "Generating buffers" << std::endl; alGenBuffers(NUM_BUFFERS, buffers); Check(); + std::cout << "Generating source" << std::endl; alGenSources(1, &source); Check(); + std::cout << "Configuring source" << std::endl; alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0); alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0); Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcOptions.cpp 9 Dec 2003 00:36:03 -0000 1.5 --- tcOptions.cpp 29 Feb 2004 22:51:35 -0000 1.6 *************** *** 59,62 **** --- 59,70 ---- oi.mnStateCount = 2; oi.mnValue = 0; + oi.mpAssociated = &disableSound; + oi.mzCaption[0] = "Sound Enabled"; + oi.mzCaption[1] = "Sound Disabled"; + AddOption(oi); + + oi.meType = tsOptionInfo::OT_RADIOBUTTON; + oi.mnStateCount = 2; + oi.mnValue = 0; oi.mpAssociated = &mbPlayMusic; oi.mzCaption[0] = "Music OFF"; Index: tcOptionsView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptionsView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcOptionsView.cpp 30 Nov 2003 17:23:52 -0000 1.3 --- tcOptionsView.cpp 29 Feb 2004 22:51:35 -0000 1.4 *************** *** 209,215 **** } mpOptions->Serialize(false); // create new options file ! if (mpSound != NULL) { ! mpSound->PlayEffect(SEFFECT_BEEP2); ! } } else --- 209,214 ---- } mpOptions->Serialize(false); // create new options file ! ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else *************** *** 258,262 **** mpFont = NULL; mpBrush = NULL; - mpSound = NULL; mnXStart = 100; mnYStart = 100; --- 257,260 ---- Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcSound.cpp 13 Feb 2004 01:31:33 -0000 1.12 --- tcSound.cpp 29 Feb 2004 22:51:35 -0000 1.13 *************** *** 106,111 **** if((alGetError())!=AL_NO_ERROR) { ! printf("error loading waves "); ! } --- 106,110 ---- if((alGetError())!=AL_NO_ERROR) { ! fprintf(stderr, "Error loading wav files.\n"); } *************** *** 229,232 **** --- 228,233 ---- void tcSound::PlayMusic(std::string song) { + if (!mbInitialized) return; + std::string musicPath = OGG_PATH; musicPath += song; *************** *** 241,244 **** --- 242,246 ---- void tcSound::QueueMusic(std::string song) { + if (!mbInitialized) return; oggStreamer->Queue(song); } *************** *** 246,249 **** --- 248,253 ---- void tcSound::QueueRandomMusic() { + if (!mbInitialized) return; + wxArrayString fileList; int fileCount = (int)wxDir::GetAllFiles(OGG_PATH, &fileList, "*.ogg", wxDIR_FILES); *************** *** 257,260 **** --- 261,265 ---- void tcSound::SeekMusic(double seekTime) { + if (!mbInitialized) return; oggStreamer->Seek(seekTime); } *************** *** 262,265 **** --- 267,271 ---- void tcSound::SetMusicPause(bool state) { + if (!mbInitialized) return; oggStreamer->SetPause(state); } *************** *** 269,272 **** --- 275,279 ---- void tcSound::SetMusicVolume(float vol) { + if (!mbInitialized) return; oggStreamer->SetVolume(vol); } *************** *** 284,287 **** --- 291,295 ---- void tcSound::StopMusic() { + if (!mbInitialized) return; if (meMusicState != MS_STOPPED) { *************** *** 304,307 **** --- 312,316 ---- void tcSound::UpdateAutoMusic(double afStatusTime) { + if (!mbInitialized) return; if (meMusicState == MS_STOPPED) return; if (!oggStreamer->Update()) *************** *** 440,443 **** --- 449,487 ---- + + 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; + + } + + /** + * Method for accessing singleton instance. + */ + tcSound* tcSound::Get() + { + static tcSound instance; + + return &instance; + } + tcSound::tcSound() { *************** *** 458,488 **** mnEffectVolume = 1; // 3 dB attenuation oggStreamer = new tcOggStreamer(); } ! void tcSound::UnInit() { ! int i; ! ! 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; ! } - tcSound::~tcSound() { --- 502,519 ---- mnEffectVolume = 1; // 3 dB attenuation + std::cout << "Creating OGG streamer" << std::endl; oggStreamer = new tcOggStreamer(); + std::cout << "Success - Create OGG streamer" << std::endl; } ! /** ! * Should never be called. ! */ ! tcSound::tcSound(const tcSound& source) { ! wxASSERT(false); } tcSound::~tcSound() { Index: tcSoundConsole.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSoundConsole.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSoundConsole.cpp 3 Jan 2004 00:45:12 -0000 1.5 --- tcSoundConsole.cpp 29 Feb 2004 22:51:36 -0000 1.6 *************** *** 37,45 **** int tcSoundConsole::Draw() { - wxASSERT(mpSound); - if (Redraw()) { ! mpSound->PlayEffect(mnSoundEffect); } --- 37,43 ---- int tcSoundConsole::Draw() { if (Redraw()) { ! tcSound::Get()->PlayEffect(mnSoundEffect); } *************** *** 48,55 **** /********************************************************************/ ! int tcSoundConsole::Print(const char* line) { ! if (mpSound != NULL) { ! mpSound->PlayEffect(mnSoundEffect); ! } return tcConsole::Print(line); } --- 46,53 ---- /********************************************************************/ ! int tcSoundConsole::Print(const char* line) ! { ! tcSound::Get()->PlayEffect(mnSoundEffect); ! return tcConsole::Print(line); } *************** *** 61,65 **** tcConsole(parent, pos, size, name) { - mpSound = NULL; mnSoundEffect = SEFFECT_CONSOLE; } --- 59,62 ---- |
|
From: <ddc...@us...> - 2004-02-29 23:02:10
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13290/src/scriptinterface Modified Files: tcPlatformInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcPlatformInterface.cpp 18 Feb 2004 18:53:55 -0000 1.19 --- tcPlatformInterface.cpp 29 Feb 2004 22:51:36 -0000 1.20 *************** *** 806,810 **** void tcPlatformInterface::PlaySound(int n) { ! if (mpSound) mpSound->PlayEffect(n); } --- 806,810 ---- void tcPlatformInterface::PlaySound(int n) { ! tcSound::Get()->PlayEffect(n); } *************** *** 855,859 **** tcSimState* tcPlatformInterface::mpSimState = NULL; tcAllianceSensorMap* tcPlatformInterface::mpSensorMap = NULL; - tcSound* tcPlatformInterface::mpSound = NULL; tcSoundConsole* tcPlatformInterface::mpConsole = NULL; tcCommandQueue* tcPlatformInterface::mpCommandQueue = NULL; --- 855,858 ---- |