gcblue-commits Mailing List for Global Conflict Blue (Page 65)
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: <ddc...@us...> - 2004-02-18 19:03:44
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5340 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** GCblue.vcproj 15 Feb 2004 19:47:21 -0000 1.38 --- GCblue.vcproj 18 Feb 2004 18:53:54 -0000 1.39 *************** *** 39,43 **** Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23_d.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib Producerd.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" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" --- 39,43 ---- 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" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" *************** *** 99,103 **** <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgProducer.lib osgDB.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" --- 99,103 ---- <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/src/sim Modified Files: Tag: v0_5_0 Game.cpp tcCreditView.cpp tcMapView.cpp tcObjectControl.cpp tcStartView.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.52.2.2 retrieving revision 1.52.2.3 diff -C2 -d -r1.52.2.2 -r1.52.2.3 *** Game.cpp 25 Jan 2004 17:36:28 -0000 1.52.2.2 --- Game.cpp 17 Feb 2004 14:27:02 -0000 1.52.2.3 *************** *** 126,132 **** directorTime = 0; ! mnBriefingWidth = 350; ! mnLeftMargin = 200; ! mnBottomMargin = 200; std::cout << "Game constructor success" << std::endl; --- 126,130 ---- directorTime = 0; ! InitializeScreenSizeParams(size); std::cout << "Game constructor success" << std::endl; *************** *** 280,287 **** { int margin = (meScreenMode == TACTICALBRIEF) ? mnBriefingWidth : mnLeftMargin; ! r.x = margin; r.y = 0; ! r.width = mnWidth-margin; ! r.height = mnHeight-mnBottomMargin; } else // size3D = MODE3D_FULL --- 278,285 ---- { int margin = (meScreenMode == TACTICALBRIEF) ? mnBriefingWidth : mnLeftMargin; ! r.x = margin + 1; r.y = 0; ! r.width = mnWidth-margin - 1; ! r.height = mnHeight-mnBottomMargin - 1; } else // size3D = MODE3D_FULL *************** *** 403,408 **** void tcGame::Initialize3DViewer() { ! smallViewerPosition = wxPoint(mnWidth - 380, 0); ! smallViewerSize = wxSize(380, 200); viewer = new tc3DViewer(this, smallViewerPosition, smallViewerSize); --- 401,414 ---- void tcGame::Initialize3DViewer() { ! if (mnWidth > 1000) ! { ! smallViewerPosition = wxPoint(mnWidth - 380, 0); ! smallViewerSize = wxSize(380, 200); ! } ! else // support for 800 x 600 ! { ! smallViewerPosition = wxPoint(mnWidth - 285, 0); ! smallViewerSize = wxSize(285, 150); ! } viewer = new tc3DViewer(this, smallViewerPosition, smallViewerSize); *************** *** 607,616 **** } void tcGame::InitializeTacticalMap() { ! mrectMap.left = 200; mrectMap.top = 0; mrectMap.right = mnWidth; //GetSystemMetrics(SM_CXFULLSCREEN); ! mrectMap.bottom = mnHeight - 200; //GetSystemMetrics(SM_CYFULLSCREEN); tacticalMap = new tcTacticalMapView(this, wxPoint(mrectMap.left,mrectMap.top), wxSize(mrectMap.right-mrectMap.left, mrectMap.bottom-mrectMap.top)); tacticalMapSize = TM_LARGE; --- 613,655 ---- } + /** + * Called at startup to initialize parameters that are sensitive + * to screen size e.g. window sizes and placements. + * @param screenSize wxSize object for screen size + */ + void tcGame::InitializeScreenSizeParams(const wxSize& screenSize) + { + fprintf(stdout, "screen size: %d x %d\n", + screenSize.GetWidth(), screenSize.GetHeight()); + if (screenSize.GetWidth() >= 1280) + { + mnBriefingWidth = 350; + mnLeftMargin = 200; + mnLeftMargin2 = 200; + mnBottomMargin = 200; + } + else if (screenSize.GetWidth() >= 1024) + { + mnBriefingWidth = 320; + mnLeftMargin = 200; + mnLeftMargin2 = 160; + mnBottomMargin = 200; + } + else + { + mnBriefingWidth = 300; + mnLeftMargin = 160; + mnLeftMargin2 = 160; + mnBottomMargin = 200; + } + } + + void tcGame::InitializeTacticalMap() { ! mrectMap.left = mnLeftMargin; mrectMap.top = 0; mrectMap.right = mnWidth; //GetSystemMetrics(SM_CXFULLSCREEN); ! mrectMap.bottom = mnHeight - mnBottomMargin; //GetSystemMetrics(SM_CYFULLSCREEN); tacticalMap = new tcTacticalMapView(this, wxPoint(mrectMap.left,mrectMap.top), wxSize(mrectMap.right-mrectMap.left, mrectMap.bottom-mrectMap.top)); tacticalMapSize = TM_LARGE; *************** *** 642,650 **** /* ** Info console init * **/ mrectLowerLeft.left = 0; ! mrectLowerLeft.top = mnHeight-200; ! mrectLowerLeft.right = 200; mrectLowerLeft.bottom = mnHeight; ! infoConsole = new tcSoundConsole(this, wxPoint(mrectLowerLeft.left,mrectLowerLeft.top), wxSize(200,200)); if (!infoConsole) --- 681,690 ---- /* ** Info console init * **/ mrectLowerLeft.left = 0; ! mrectLowerLeft.top = mnHeight-mnBottomMargin; ! mrectLowerLeft.right = mnLeftMargin; mrectLowerLeft.bottom = mnHeight; ! infoConsole = new tcSoundConsole(this, ! wxPoint(mrectLowerLeft.left,mrectLowerLeft.top), wxSize(mnLeftMargin,mnBottomMargin)); if (!infoConsole) *************** *** 663,669 **** infoConsole->AttachSound(&mcSound); infoConsole->SetEffect(-1); //SEFFECT_MUTEDBEEP); // no sound ! infoConsole->InitGdi(10.0f,0xFF64FF64); ! infoConsole->SetLineSpacing(10); ! infoConsole->SetWrap(28); infoConsole->SetActive(false); infoConsole->SetSkipCount(mcOptions.renderSkipCount); --- 703,718 ---- infoConsole->AttachSound(&mcSound); infoConsole->SetEffect(-1); //SEFFECT_MUTEDBEEP); // no sound ! if (mnWidth > 1000) ! { ! infoConsole->InitGdi(10.0f,0xFF64FF64); ! infoConsole->SetLineSpacing(10); ! infoConsole->SetWrap(28); ! } ! else // 800 x 600 support ! { ! infoConsole->InitGdi(8.0f,0xFF64FF64); ! infoConsole->SetLineSpacing(9); ! infoConsole->SetWrap(26); ! } infoConsole->SetActive(false); infoConsole->SetSkipCount(mcOptions.renderSkipCount); *************** *** 672,676 **** /* ** hookInfo init * **/ hookInfo = new tcHookInfo(this, wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), ! wxSize(200,200)); if (!hookInfo) --- 721,725 ---- /* ** hookInfo init * **/ hookInfo = new tcHookInfo(this, wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), ! wxSize(mnLeftMargin2,mnBottomMargin)); if (!hookInfo) *************** *** 695,699 **** // objectControl init ! objectControl = new tcObjectControl(this, wxPoint(mrectLowerLeft.right+200,mrectLowerLeft.top), wxSize(mnWidth-400,200)); if (!objectControl) --- 744,750 ---- // objectControl init ! objectControl = new tcObjectControl(this, ! wxPoint(mrectLowerLeft.right+mnLeftMargin2,mrectLowerLeft.top), ! wxSize(mnWidth-mnLeftMargin-mnLeftMargin2,mnBottomMargin)); if (!objectControl) *************** *** 721,726 **** mrectOOB.left = 0; mrectOOB.top = 0; ! mrectOOB.right = 200; ! mrectOOB.bottom = mnHeight-200; oobView = new tcOOBView(this, wxPoint(mrectOOB.left,mrectOOB.top), wxSize(mrectOOB.right-mrectOOB.left, mrectOOB.bottom-mrectOOB.top)); --- 772,777 ---- mrectOOB.left = 0; mrectOOB.top = 0; ! mrectOOB.right = mnLeftMargin; ! mrectOOB.bottom = mnHeight-mnBottomMargin; oobView = new tcOOBView(this, wxPoint(mrectOOB.left,mrectOOB.top), wxSize(mrectOOB.right-mrectOOB.left, mrectOOB.bottom-mrectOOB.top)); *************** *** 993,996 **** --- 1044,1048 ---- { static teScreenMode lastMode = NONE; + static int skipCount = 0; tcTime::Update(); *************** *** 1001,1009 **** { case START: ! optionsView->SetActive(false); ! startView->SetActive(true); ! creditView->SetActive(false); ! scenarioSelectView->SetActive(false); ! startView->Draw(); break; case CREDIT: --- 1053,1064 ---- { case START: ! if ((mcOptions.graphicsDetail == 2)||(skipCount++ % 2 == 0)) ! { ! optionsView->SetActive(false); ! startView->SetActive(true); ! creditView->SetActive(false); ! scenarioSelectView->SetActive(false); ! startView->Draw(); ! } break; case CREDIT: *************** *** 1012,1035 **** creditView->Rewind(); } ! ! optionsView->SetActive(false); ! startView->SetActive(false); ! creditView->SetActive(true); ! scenarioSelectView->SetActive(false); ! creditView->Draw(); break; case OPTIONS: ! optionsView->SetActive(true); ! startView->SetActive(false); ! creditView->SetActive(false); ! scenarioSelectView->SetActive(false); ! optionsView->Draw(); break; case SCENARIOSELECT: ! scenarioSelectView->SetActive(true); ! optionsView->SetActive(false); ! startView->SetActive(false); ! creditView->SetActive(false); ! scenarioSelectView->Draw(); break; } --- 1067,1098 ---- creditView->Rewind(); } ! if ((mcOptions.graphicsDetail == 2)||(skipCount++ % 2 == 0)) ! { ! optionsView->SetActive(false); ! startView->SetActive(false); ! creditView->SetActive(true); ! scenarioSelectView->SetActive(false); ! creditView->Draw(); ! } break; case OPTIONS: ! if ((mcOptions.graphicsDetail == 2)||(skipCount++ % 2 == 0)) ! { ! optionsView->SetActive(true); ! startView->SetActive(false); ! creditView->SetActive(false); ! scenarioSelectView->SetActive(false); ! optionsView->Draw(); ! } break; case SCENARIOSELECT: ! if ((mcOptions.graphicsDetail == 2)||(skipCount++ % 2 == 0)) ! { ! scenarioSelectView->SetActive(true); ! optionsView->SetActive(false); ! startView->SetActive(false); ! creditView->SetActive(false); ! scenarioSelectView->Draw(); ! } break; } *************** *** 1077,1080 **** --- 1140,1145 ---- void tcGame::UpdateForScreenMode() { + static int skipCount = 0; + bool drawEdgeWindows = (size3D != MODE3D_FULL) || (!mb3DActive); bool drawTacticalMap = (size3D == MODE3D_SMALL) || (!mb3DActive); *************** *** 1092,1099 **** --- 1157,1167 ---- viewer->SetActive(mb3DActive); + if ((mcOptions.graphicsDetail < 2)&&(skipCount++ % 2 != 0)) return; if (drawTacticalMap) { tacticalMap->Draw(); } + if (popupControl->mbActive) popupControl->Draw(); + if (drawEdgeWindows) { *************** *** 1103,1107 **** objectControl->Draw(); } ! if (popupControl->mbActive) popupControl->Draw(); } else if (meScreenMode == TACTICALBRIEF) --- 1171,1175 ---- objectControl->Draw(); } ! if ((mcOptions.graphicsDetail < 2)&&(skipCount % 4 != 0)) return; } else if (meScreenMode == TACTICALBRIEF) *************** *** 1118,1121 **** --- 1186,1190 ---- viewer->SetActive(mb3DActive); + if ((mcOptions.graphicsDetail < 2)&&(skipCount++ % 2 != 0)) return; if (drawTacticalMap) { *************** *** 1309,1313 **** if (directorTime >= 0.1f) { ! mpGraphicsEngine->RenderAll(); if (mcOptions.debugLevel > 1) --- 1378,1389 ---- if (directorTime >= 0.1f) { ! ! if ((size3D != MODE3D_FULL) || (!mb3DActive)) ! { ! if ((mcOptions.graphicsDetail != 0) || (snFrameCount % 2 == 0)) ! { ! mpGraphicsEngine->RenderAll(); ! } ! } if (mcOptions.debugLevel > 1) *************** *** 1317,1320 **** --- 1393,1397 ---- viewer->Frame(); + } Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCreditView.cpp,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -C2 -d -r1.6.2.3 -r1.6.2.4 *** tcCreditView.cpp 25 Jan 2004 17:36:29 -0000 1.6.2.3 --- tcCreditView.cpp 17 Feb 2004 14:27:03 -0000 1.6.2.4 *************** *** 38,301 **** void tcCreditView::AddCredit(tcString& s, float afTrailSpace, int effect) { ! if (mnCredits >= MAX_CREDITS) {return;} ! maCredit[mnCredits].mfTrailSpace = afTrailSpace; ! maCredit[mnCredits].mnEffect = effect; ! maCredit[mnCredits++].mzCaption = s; } /*******************************************************************************/ bool tcCreditView::Init() { ! tcString s; ! s = "------- C R E D I T S -------"; ! AddCredit(s, 40.0f, 1); ! s = "Dewitt \"Cole\" Colclough"; ! AddCredit(s, 25.0f, 1); ! s = "Project manager and lead developer\n"; ! AddCredit(s, 80.0f, 0); ! s = "Marcelo C\341ceres (op4_delta)"; ! AddCredit(s, 25.0f, 1); ! s = "3D art"; ! AddCredit(s, 60.0f, 0); ! s = "Marco Belli"; ! AddCredit(s, 25.0f, 1); ! s = "Developer - Sound, Linux port"; ! AddCredit(s, 60.0f, 0); ! s = "Jason Morris"; ! AddCredit(s, 25.0f, 1); ! s = "Developer"; ! AddCredit(s, 60.0f, 0); ! s = "Test\n"; ! AddCredit(s, 23.0f, 1); ! AddCredit(tcString("Marco Belli"), 12.0f, 2); ! AddCredit(tcString("Marcelo C\341ceres"), 12.0f, 2); ! AddCredit(tcString("Rob Carpenter"), 12.0f, 2); ! AddCredit(tcString("Paul Daly"), 12.0f, 2); ! AddCredit(tcString("Dust"), 12.0f, 2); ! AddCredit(tcString("Jason Morris"), 12.0f, 2); ! AddCredit(tcString("Andrew Platfoot"), 12.0f, 2); ! AddCredit(tcString("Justin Priestman"), 12.0f, 2); ! AddCredit(tcString("Gregg Smith"), 38.0f+12.0f, 2); ! s = "Some 2D art courtesy of U.S. Navy, www.news.navy.mil/view_galleries.asp \n"; ! AddCredit(s, 60.0f, 0); ! s = "3D sky code\n"; ! AddCredit(s, 25.0f, 0); ! s = "Combat Simulator Project, csp.sourceforge.net \n"; ! AddCredit(s, 60.0f, 1); ! s = "Map data based on GTOPO30 archive distributed by the \nLand Processes Distributed Active Archive Center (LP DAAC)\nlpdaac.usgs.gov \n"; ! AddCredit(s, 100.0f, 0); ! s = "Thanks to the developers of these software libraries:\n"; ! AddCredit(s, 30.0f, 0); ! s = "wxWindows\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.wxwindows.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Python 2.3\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.python.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Boost Python\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.boost.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "OpenSceneGraph\n"; ! AddCredit(s, 20.0f, 0); ! s = "openscenegraph.sourceforge.net\n"; ! AddCredit(s, 60.0f, 0); ! s = "Special thanks to:"; ! AddCredit(s, 30.0f, 0); ! s = "Harpoon HQ, www.harpoonhq.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Mille-Sabords, www.mille-sabords.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Seawolves Surface Division, www.seawolves.org/fc\n"; ! AddCredit(s, 30.0f, 0); ! s = "and\n"; ! AddCredit(s, 30.0f, 0); ! ! s = "To those who offered advice through e-mail and \nthe global_conflict discussion group"; ! AddCredit(s, 120.0f, 0); - s = "GLOBAL CONFLICT BLUE"; - AddCredit(s, 20.0f, 0); ! s = "An open source project"; ! AddCredit(s, 20.0f, 0); ! s = "www.gcblue.com"; ! AddCredit(s, 20.0f, 0); ! s = "Copyright (C) 2002-2004, All rights reserved.\n"; ! AddCredit(s, 60.0f, 0); - FontFamily ff(L"Arial"); - mpFont = new Font(&ff,16,FontStyleRegular,UnitPixel); - if (mpFont == NULL) { - WTL("tcCreditView - mpFont creation failed\n"); - return false; - } - mpFontLarge = new Font(&ff,20,FontStyleBold,UnitPixel); - if (mpFontLarge == NULL) { - WTL("tcCreditView - mpFontLarge creation failed\n"); - return false; - } - mpFontSmall = new Font(&ff,12,FontStyleRegular,UnitPixel); - if (mpFontSmall == NULL) { - WTL("tcCreditView - mpFontSmall creation failed\n"); - return false; - } ! mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB ! if (mpBrush == NULL) { ! WTL("tcCreditView - mpBrush creation failed\n"); ! return false; ! } ! mpPen = new Pen(Color(255,200,200,200),2); ! if (mpPen == NULL) { ! WTL("tcCreditView - mpPen creation failed\n"); ! return false; ! } ! Rewind(); ! return true; } /*******************************************************************************/ int tcCreditView::Draw() { ! static WCHAR szwchar[256]; ! UINT32 nDeltaTime = mcTime.snCount_30Hz - mnStartTime; ! ! Graphics *pGraphics; ! Erase(); ! if (!GetGraphics(pGraphics)) { ! return false; ! } ! DrawBackground(pGraphics); ! // Get the text rendering hint. ! TextRenderingHint oldhint = pGraphics->GetTextRenderingHint(); ! // Set the text rendering hint to TextRenderingHintAntiAlias. ! pGraphics->SetTextRenderingHint(TextRenderingHintAntiAlias); ! float fY = (float)mnHeight - 2*0.5f*(float)nDeltaTime; ! float fX = 0.5f*(float)mnWidth; ! ! const UINT32 nColorFade = 0x8E328032; ! const UINT32 nColorBright = 0xFE64FF64; ! mpBrush->SetColor(Color(nColorBright)); // font color ! //DrawTextCentered(pGraphics, mpFont, mpBrush, crawlstring.GetBuffer(), fX,fY); ! static int nFlashId = -1; ! static bool bFlash = false; ! static UINT32 snFocusTime; ! static tcString szFocus; ! // reset static variables if rewind occured ! if (mbDrawRewind) { ! nFlashId = -1; ! bFlash = false; ! mbDrawRewind = false; ! } ! 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) { ! UINT32 nDeltaFocusTime = (mcTime.snCount_30Hz - snFocusTime); ! } ! for (int n=0;n<(int)mnCredits;n++) { ! tcString s = maCredit[n].mzCaption; ! const float fEffectZone = 60.0f; ! float dyeffect = fY - ((float)mnHeight - fEffectZone); ! if ((dyeffect >= 0)&&(dyeffect <= fEffectZone)) { ! mpBrush->SetColor(Color(nColorFade)); // font color ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 20.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 20.0f*dyeffect,fY); ! mpBrush->SetColor(Color(nColorBright)); // font color ! } ! else if (fY <= (float)mnHeight) { ! if ((n > nFlashId)&&(maCredit[n].mnEffect == 1)) { ! nFlashId = n; ! bFlash = true; ! } ! else { ! bFlash = false; ! } ! Font *pFont = mpFont; ! if (maCredit[n].mnEffect == 1) ! { ! pFont = mpFontLarge; ! } ! else if (maCredit[n].mnEffect == 2) ! { ! pFont = mpFontSmall; ! } ! mpBrush->SetColor(Color(nColorFade)); // font color ! ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), ! fX + 1.0f,fY + 1.0f); ! mpBrush->SetColor(Color(nColorBright)); // font color ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), fX,fY); ! } ! fY += maCredit[n].mfTrailSpace; ! } ! pGraphics->SetTextRenderingHint(oldhint); ! ReleaseGraphics(pGraphics); ! DrawBorder(); ! // rewind after credits are done crawling ! if (fY < -100.0f) { ! Rewind(); ! } ! return true; } --- 38,301 ---- void tcCreditView::AddCredit(tcString& s, float afTrailSpace, int effect) { ! if (mnCredits >= MAX_CREDITS) {return;} ! maCredit[mnCredits].mfTrailSpace = afTrailSpace; ! maCredit[mnCredits].mnEffect = effect; ! maCredit[mnCredits++].mzCaption = s; } /*******************************************************************************/ bool tcCreditView::Init() { ! tcString s; ! s = "------- C R E D I T S -------"; ! AddCredit(s, 40.0f, 1); ! s = "Dewitt \"Cole\" Colclough"; ! AddCredit(s, 25.0f, 1); ! s = "Project manager and lead developer\n"; ! AddCredit(s, 80.0f, 0); ! s = "Marcelo C\341ceres (op4_delta)"; ! AddCredit(s, 25.0f, 1); ! s = "3D art"; ! AddCredit(s, 60.0f, 0); ! s = "Marco Belli"; ! AddCredit(s, 25.0f, 1); ! s = "Developer - Sound, Linux port"; ! AddCredit(s, 60.0f, 0); ! s = "Jason Morris"; ! AddCredit(s, 25.0f, 1); ! s = "Developer"; ! AddCredit(s, 60.0f, 0); ! s = "Test\n"; ! AddCredit(s, 23.0f, 1); ! AddCredit(tcString("Marco Belli"), 12.0f, 2); ! AddCredit(tcString("Marcelo C\341ceres"), 12.0f, 2); ! AddCredit(tcString("Rob Carpenter"), 12.0f, 2); ! AddCredit(tcString("Paul Daly"), 12.0f, 2); ! AddCredit(tcString("Dust"), 12.0f, 2); ! AddCredit(tcString("Jason Morris"), 12.0f, 2); ! AddCredit(tcString("Andrew Platfoot"), 12.0f, 2); ! AddCredit(tcString("Justin Priestman"), 12.0f, 2); ! AddCredit(tcString("Gregg Smith"), 38.0f+12.0f, 2); ! s = "Some 2D art courtesy of U.S. Navy, www.news.navy.mil/view_galleries.asp \n"; ! AddCredit(s, 60.0f, 0); ! s = "3D sky code\n"; ! AddCredit(s, 25.0f, 0); ! s = "Combat Simulator Project, csp.sourceforge.net \n"; ! AddCredit(s, 60.0f, 1); ! s = "Map data based on GTOPO30 archive distributed by the \nLand Processes Distributed Active Archive Center (LP DAAC)\nlpdaac.usgs.gov \n"; ! AddCredit(s, 100.0f, 0); ! s = "Thanks to the developers of these software libraries:\n"; ! AddCredit(s, 30.0f, 0); ! s = "wxWindows\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.wxwindows.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Python 2.3\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.python.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Boost Python\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.boost.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "OpenSceneGraph\n"; ! AddCredit(s, 20.0f, 0); ! s = "openscenegraph.sourceforge.net\n"; ! AddCredit(s, 60.0f, 0); ! s = "Special thanks to:"; ! AddCredit(s, 30.0f, 0); ! s = "Harpoon HQ, www.harpoonhq.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Mille-Sabords, www.mille-sabords.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Seawolves Surface Division, www.seawolves.org/fc\n"; ! AddCredit(s, 30.0f, 0); ! s = "and\n"; ! AddCredit(s, 30.0f, 0); + s = "To those who offered advice through e-mail and \nthe global_conflict discussion group"; + AddCredit(s, 120.0f, 0); ! s = "GLOBAL CONFLICT BLUE"; ! AddCredit(s, 20.0f, 0); ! s = "An open source project"; ! AddCredit(s, 20.0f, 0); ! s = "www.gcblue.com"; ! AddCredit(s, 20.0f, 0); + s = "Copyright (C) 2002-2004, All rights reserved.\n"; + AddCredit(s, 60.0f, 0); ! FontFamily ff(L"Arial"); ! mpFont = new Font(&ff,16,FontStyleRegular,UnitPixel); ! if (mpFont == NULL) { ! WTL("tcCreditView - mpFont creation failed\n"); ! return false; ! } ! mpFontLarge = new Font(&ff,20,FontStyleBold,UnitPixel); ! if (mpFontLarge == NULL) { ! WTL("tcCreditView - mpFontLarge creation failed\n"); ! return false; ! } ! mpFontSmall = new Font(&ff,12,FontStyleRegular,UnitPixel); ! if (mpFontSmall == NULL) { ! WTL("tcCreditView - mpFontSmall creation failed\n"); ! return false; ! } ! mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB ! if (mpBrush == NULL) { ! WTL("tcCreditView - mpBrush creation failed\n"); ! return false; ! } ! mpPen = new Pen(Color(255,200,200,200),2); ! if (mpPen == NULL) { ! WTL("tcCreditView - mpPen creation failed\n"); ! return false; ! } ! ! Rewind(); ! return true; } /*******************************************************************************/ int tcCreditView::Draw() { ! static WCHAR szwchar[256]; ! UINT32 nDeltaTime = mcTime.snCount_30Hz - mnStartTime; ! Graphics *pGraphics; ! Erase(); ! if (!GetGraphics(pGraphics)) { ! return false; ! } ! DrawBackground(pGraphics); ! // Get the text rendering hint. ! TextRenderingHint oldhint = pGraphics->GetTextRenderingHint(); + // Set the text rendering hint to TextRenderingHintAntiAlias. + pGraphics->SetTextRenderingHint(TextRenderingHintAntiAlias); ! float textVelocity = 0.0007f*mnHeight; ! float fY = (float)mnHeight - textVelocity*(float)nDeltaTime; ! float fX = 0.5f*(float)mnWidth; ! const UINT32 nColorFade = 0x8E328032; ! const UINT32 nColorBright = 0xFE64FF64; ! mpBrush->SetColor(Color(nColorBright)); // font color ! //DrawTextCentered(pGraphics, mpFont, mpBrush, crawlstring.GetBuffer(), fX,fY); ! static int nFlashId = -1; ! static bool bFlash = false; ! static UINT32 snFocusTime; ! static tcString szFocus; ! // reset static variables if rewind occured ! if (mbDrawRewind) { ! nFlashId = -1; ! bFlash = false; ! mbDrawRewind = false; ! } ! 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) { ! UINT32 nDeltaFocusTime = (mcTime.snCount_30Hz - snFocusTime); ! } ! for (int n=0;n<(int)mnCredits;n++) { ! tcString s = maCredit[n].mzCaption; ! const float fEffectZone = 60.0f; ! float dyeffect = fY - ((float)mnHeight - fEffectZone); ! if ((dyeffect >= 0)&&(dyeffect <= fEffectZone)) { ! mpBrush->SetColor(Color(nColorFade)); // font color ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 20.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 20.0f*dyeffect,fY); ! mpBrush->SetColor(Color(nColorBright)); // font color ! } ! else if (fY <= (float)mnHeight) { ! if ((n > nFlashId)&&(maCredit[n].mnEffect == 1)) { ! nFlashId = n; ! bFlash = true; ! } ! else { ! bFlash = false; ! } ! Font *pFont = mpFont; ! if (maCredit[n].mnEffect == 1) ! { ! pFont = mpFontLarge; ! } ! else if (maCredit[n].mnEffect == 2) ! { ! pFont = mpFontSmall; ! } ! mpBrush->SetColor(Color(nColorFade)); // font color ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), ! fX + 1.0f,fY + 1.0f); ! mpBrush->SetColor(Color(nColorBright)); // font color ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), fX,fY); ! } ! fY += maCredit[n].mfTrailSpace; ! } ! ! pGraphics->SetTextRenderingHint(oldhint); ! ReleaseGraphics(pGraphics); ! DrawBorder(); ! ! // rewind after credits are done crawling ! if (fY < -100.0f) { ! Rewind(); ! } ! return true; } *************** *** 312,317 **** void tcCreditView::Rewind() { ! mnStartTime = mcTime.snCount_30Hz; ! mbDrawRewind = true; } --- 312,317 ---- void tcCreditView::Rewind() { ! mnStartTime = mcTime.snCount_30Hz; ! mbDrawRewind = true; } *************** *** 326,344 **** : tcWindow(parent, pos, size, name) { ! mpFont = NULL; ! mpFontLarge = NULL; ! mpFontSmall = NULL; ! mpBrush = NULL; ! mpSound = NULL; ! mnCredits = 0; ! mbDrawRewind = false; } tcCreditView::~tcCreditView() { ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpFontSmall != NULL) {delete mpFontSmall;} ! if (mpBrush != NULL) {delete mpBrush;} ! if (mpPen != NULL) {delete mpPen;} } --- 326,344 ---- : tcWindow(parent, pos, size, name) { ! mpFont = NULL; ! mpFontLarge = NULL; ! mpFontSmall = NULL; ! mpBrush = NULL; ! mpSound = NULL; ! mnCredits = 0; ! mbDrawRewind = false; } tcCreditView::~tcCreditView() { ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpFontSmall != NULL) {delete mpFontSmall;} ! if (mpBrush != NULL) {delete mpBrush;} ! if (mpPen != NULL) {delete mpPen;} } Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.15.2.2 retrieving revision 1.15.2.3 diff -C2 -d -r1.15.2.2 -r1.15.2.3 *** tcMapView.cpp 25 Jan 2004 17:36:30 -0000 1.15.2.2 --- tcMapView.cpp 17 Feb 2004 14:27:03 -0000 1.15.2.3 *************** *** 96,104 **** mfGridBaseLon_rad = mfGridSize_rad*floorf(mrectCurrentView.left/mfGridSize_rad); mfGridBaseLat_rad = mfGridSize_rad*floorf(mrectCurrentView.bottom/mfGridSize_rad); ! mfScale_pelprad = mnWidth/mfLonWidth; ! mfScale_radppel = 1/mfScale_pelprad; ! // TODO: update ! // if(mpDDS_Terrain!=NULL) mpMapData->UpdateSurface(mpDDS_Terrain,mrectCurrentView); } /** * Works with Thaw to prevent flicker on resize --- 96,106 ---- mfGridBaseLon_rad = mfGridSize_rad*floorf(mrectCurrentView.left/mfGridSize_rad); mfGridBaseLat_rad = mfGridSize_rad*floorf(mrectCurrentView.bottom/mfGridSize_rad); ! ! mfScaleX_pelprad = mnWidth/mfLonWidth; ! mfScaleX_radppel = 1/mfScaleX_pelprad; ! mfScaleY_pelprad = mnHeight/mfLatWidth; ! mfScaleY_radppel = 1/mfScaleY_pelprad; } + /** * Works with Thaw to prevent flicker on resize *************** *** 115,120 **** tcPoint tcMapView::GeoToScreen(tcPoint pgeo) { tcPoint pscreen; ! pscreen.x = (pgeo.x - mfLonCenter)*mfScale_pelprad + mnXCenter; ! pscreen.y = (-pgeo.y + mfLatCenter)*mfScale_pelprad + mnYCenter; return pscreen; } --- 117,122 ---- tcPoint tcMapView::GeoToScreen(tcPoint pgeo) { tcPoint pscreen; ! pscreen.x = (pgeo.x - mfLonCenter)*mfScaleX_pelprad + mnXCenter; ! pscreen.y = (-pgeo.y + mfLatCenter)*mfScaleY_pelprad + mnYCenter; return pscreen; } *************** *** 122,138 **** tcPoint tcMapView::GeoToScreen(float afLon, float afLat) { tcPoint pscreen; ! pscreen.x = (afLon - mfLonCenter)*mfScale_pelprad + mnXCenter; ! pscreen.y = (-afLat + mfLatCenter)*mfScale_pelprad + mnYCenter; return pscreen; } /***********************************************************************************/ float tcMapView::GeoExtentToScreen(float afExtent_rad) { ! return afExtent_rad*mfScale_pelprad; } /***********************************************************************************/ tcPoint tcMapView::ScreenToGeo(wxPoint pscreen) { tcPoint pgeo; ! pgeo.x = ((float)pscreen.x - mnXCenter)*mfScale_radppel + mfLonCenter; ! pgeo.y = ((float)-pscreen.y + mnYCenter)*mfScale_radppel + mfLatCenter; return pgeo; } --- 124,140 ---- tcPoint tcMapView::GeoToScreen(float afLon, float afLat) { tcPoint pscreen; ! pscreen.x = (afLon - mfLonCenter)*mfScaleX_pelprad + mnXCenter; ! pscreen.y = (-afLat + mfLatCenter)*mfScaleY_pelprad + mnYCenter; return pscreen; } /***********************************************************************************/ float tcMapView::GeoExtentToScreen(float afExtent_rad) { ! return afExtent_rad*mfScaleX_pelprad; } /***********************************************************************************/ tcPoint tcMapView::ScreenToGeo(wxPoint pscreen) { tcPoint pgeo; ! pgeo.x = ((float)pscreen.x - mnXCenter)*mfScaleX_radppel + mfLonCenter; ! pgeo.y = ((float)-pscreen.y + mnYCenter)*mfScaleY_radppel + mfLatCenter; return pgeo; } *************** *** 140,145 **** tcPoint tcMapView::ScreenToGeo(float x, float y) { tcPoint pgeo; ! pgeo.x = (x - mnXCenter)*mfScale_radppel + mfLonCenter; ! pgeo.y = (-y + mnYCenter)*mfScale_radppel + mfLatCenter; return pgeo; } --- 142,147 ---- tcPoint tcMapView::ScreenToGeo(float x, float y) { tcPoint pgeo; ! pgeo.x = (x - mnXCenter)*mfScaleX_radppel + mfLonCenter; ! pgeo.y = (-y + mnYCenter)*mfScaleY_radppel + mfLatCenter; return pgeo; } *************** *** 162,166 **** wxPoint pos = wxWindow::GetPosition(); // mnWidth and mnHeight updated by tcWindow::OnSize - terrainView->SetSize(wxRect(pos.x,pos.y,mnWidth,mnHeight)); CalcViewParameters(); } --- 164,167 ---- *************** *** 173,176 **** --- 174,187 ---- (p.y >= mrectCurrentView.bottom)&&(p.y <= mrectCurrentView.top); } + + /** + * override of wxWindow::SetSize so that terrainView->SetSize is called as well + */ + void tcMapView::SetSize(const wxRect& rect) + { + terrainView->SetSize(rect); + wxWindow::SetSize(rect); + } + /***********************************************************************************/ void tcMapView::SetViewCenterZoom(wxPoint pscreen, float afZoom) *************** *** 337,344 **** ! fKmPerPel = mfScale_radppel*C_RADTOKM; // calculate closest power of 10 km dist that corresponds to (about) 100 pixels fKmScale = expf(logf(10.0f)*floorf(log10f(fKmPerPel*120.0f))); ! nScaleBarWidth = (int)(fKmScale*C_KMTORAD*mfScale_pelprad); tcString sText; --- 348,355 ---- ! fKmPerPel = mfScaleX_radppel*C_RADTOKM; // calculate closest power of 10 km dist that corresponds to (about) 100 pixels fKmScale = expf(logf(10.0f)*floorf(log10f(fKmPerPel*120.0f))); ! nScaleBarWidth = (int)(fKmScale*C_KMTORAD*mfScaleX_pelprad); tcString sText; *************** *** 1299,1303 **** // search for hook ! fHookDistance = mfScale_radppel*15.0f; // 15 pixels fMinDistance = 1e15f; nMinID = NULL_INDEX; --- 1310,1314 ---- // search for hook ! fHookDistance = mfScaleX_radppel*15.0f; // 15 pixels fMinDistance = 1e15f; nMinID = NULL_INDEX; *************** *** 1326,1330 **** float dx,dy; float fDirection_rad = (float)C_PIOVER180*afDirection_deg; ! float dr = mfScale_radppel*16.0f; // 32 pixels dx = sinf(fDirection_rad)*dr; --- 1337,1341 ---- float dx,dy; float fDirection_rad = (float)C_PIOVER180*afDirection_deg; ! float dr = mfScaleX_radppel*16.0f; // 32 pixels dx = sinf(fDirection_rad)*dr; Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** tcObjectControl.cpp 19 Jan 2004 21:20:58 -0000 1.9.2.1 --- tcObjectControl.cpp 17 Feb 2004 14:27:03 -0000 1.9.2.2 *************** *** 51,136 **** void tcAIPanel::Draw(Graphics *apGraphics) { ! static WCHAR szwchar[255]; ! float textx, texty; ! char zBuff[128]; ! std::string s; ! if (mpAIData == NULL) {return;} [...2904 lines suppressed...] ! } ! mpFontLarge = new Font(&ff,14,FontStyleBold,UnitPixel); ! if (mpFontLarge == NULL) ! { ! WTL("tcObjectControl - mpFontLarge creation failed\n"); ! } ! mpBrush = new SolidBrush(Color(254,100,255,100)); ! if (mpBrush == NULL) ! { ! WTL("tcObjectControl - mpBrush creation failed\n"); ! } } tcObjectControl::~tcObjectControl() { ! if (mpPen != NULL) {delete mpPen;} ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpBrush != NULL) {delete mpBrush;} } Index: tcStartView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcStartView.cpp,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** tcStartView.cpp 3 Dec 2003 05:50:19 -0000 1.8 --- tcStartView.cpp 17 Feb 2004 14:27:03 -0000 1.8.2.1 *************** *** 41,45 **** { char zBuff[96]; ! for(int i=0; i < N_START_BUTTONS; i++) { --- 41,45 ---- { char zBuff[96]; ! int buttonReduction = (mnWidth < 1000) ? 10 : 0; // to support 800 x 600 mode for(int i=0; i < N_START_BUTTONS; i++) { *************** *** 49,54 **** MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); pButton->mpiButtonOff = new Image(mzwchar,false); ! pButton->mnButtonWidth = pButton->mpiButtonOff->GetWidth(); ! pButton->mnButtonHeight = pButton->mpiButtonOff->GetHeight(); sprintf(zBuff,"%sstart%d%s",IMAGE_PATH,i,"_on.jpg"); --- 49,54 ---- MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); pButton->mpiButtonOff = new Image(mzwchar,false); ! pButton->mnButtonWidth = pButton->mpiButtonOff->GetWidth() - buttonReduction; ! pButton->mnButtonHeight = pButton->mpiButtonOff->GetHeight() - buttonReduction; sprintf(zBuff,"%sstart%d%s",IMAGE_PATH,i,"_on.jpg"); *************** *** 319,323 **** xpos += 0*pButton->mnButtonWidth; ypos += pButton->mnButtonHeight; ! ypos += 32; } --- 319,323 ---- xpos += 0*pButton->mnButtonWidth; ypos += pButton->mnButtonHeight; ! ypos += mnButtonSpacing; } *************** *** 370,373 **** --- 370,374 ---- mnXStart = 200; mnYStart = 300; + mnButtonSpacing = 32; } else if (parentSize.GetHeight() > 700) *************** *** 375,383 **** mnXStart = 200; mnYStart = 200; } else { ! mnXStart = 200; ! mnYStart = 50; } --- 376,386 ---- mnXStart = 200; mnYStart = 200; + mnButtonSpacing = 32; } else { ! mnXStart = 150; ! mnYStart = 180; ! mnButtonSpacing = 18; } |
From: <ddc...@us...> - 2004-02-17 14:35:57
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/src/common Modified Files: Tag: v0_5_0 simmath.cpp tcOptions.cpp tcOptionsView.cpp tcSound.cpp Log Message: Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** simmath.cpp 8 Jan 2004 23:54:27 -0000 1.4 --- simmath.cpp 17 Feb 2004 14:27:02 -0000 1.4.2.1 *************** *** 194,197 **** --- 194,203 ---- } + bool tcGeoRect::operator==(const tcGeoRect& r) + { + return ((left == r.left)&&(right == r.right)&& + (top == r.top)&&(bottom == r.bottom)); + } + /******************************* tcTrack *******************************/ /** Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** tcOptions.cpp 9 Dec 2003 00:36:03 -0000 1.5 --- tcOptions.cpp 17 Feb 2004 14:27:02 -0000 1.5.2.1 *************** *** 116,120 **** oi.meType = tsOptionInfo::OT_RADIOBUTTON; oi.mnStateCount = 3; ! oi.mnValue = 1; oi.mpAssociated = &renderSkipCount; oi.mzCaption[0] = "2D skip off"; --- 116,120 ---- oi.meType = tsOptionInfo::OT_RADIOBUTTON; oi.mnStateCount = 3; ! oi.mnValue = 0; oi.mpAssociated = &renderSkipCount; oi.mzCaption[0] = "2D skip off"; *************** *** 123,126 **** --- 123,135 ---- AddOption(oi); + oi.meType = tsOptionInfo::OT_RADIOBUTTON; + oi.mnStateCount = 3; + oi.mnValue = 1; + oi.mpAssociated = &graphicsDetail; + oi.mzCaption[0] = "Graphics Level 0"; + oi.mzCaption[1] = "Graphics Level 1"; + oi.mzCaption[2] = "Graphics Level 2"; + AddOption(oi); + Serialize(true); // read option state from file (options.dat) Index: tcOptionsView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptionsView.cpp,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** tcOptionsView.cpp 30 Nov 2003 17:23:52 -0000 1.3 --- tcOptionsView.cpp 17 Feb 2004 14:27:02 -0000 1.3.2.1 *************** *** 35,244 **** bool tcOptionsView::Init() { ! char zBuff[96]; ! strcpy(zBuff,IMAGE_PATH); ! strcat(zBuff,"options_bk.jpg"); ! MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); ! mpiBackground = new Image(mzwchar,false); ! strcpy(zBuff,IMAGE_PATH); ! strcat(zBuff,"options_bon.bmp"); ! MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); ! mpiButtonOn = new Image(mzwchar,false); ! strcpy(zBuff,IMAGE_PATH); ! strcat(zBuff,"options_boff.bmp"); ! MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); ! mpiButtonOff = new Image(mzwchar,false); ! if (mpiBackground == NULL) { ! WTL("tcOptions - background bitmap (options_bk.jpg) load error"); ! return false; ! } ! if (mpiButtonOn == NULL) { ! WTL("tcOptions - background bitmap (options_bon.bmp) load error"); ! return false; ! } ! if (mpiButtonOff == NULL) { ! WTL("tcOptions - background bitmap (options_boff.bmp) load error"); ! return false; ! } ! FontFamily ff(L"Arial"); ! mpFont = new Font(&ff,12,FontStyleBold,UnitPixel); ! if (mpFont == NULL) { ! WTL("tcOptionsView - mpFont creation failed\n"); ! return false; ! } ! mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB ! if (mpBrush == NULL) { ! WTL("tcOptionsView - mpBrush creation failed\n"); ! return false; ! } ! mpPen = new Pen(Color(255,200,200,200),2); ! if (mpPen == NULL) { ! WTL("tcTOptionsView - mpPen creation failed\n"); ! return false; ! } ! // Get dimensions and limit to window dimensions ! // mpiButtonOn dimensions are used for all buttons ! mnBackgroundWidth = mpiBackground->GetWidth(); ! if (mnBackgroundWidth > mnWidth) {mnBackgroundWidth = mnWidth;} ! mnBackgroundHeight = mpiBackground->GetHeight(); ! if (mnBackgroundHeight > mnHeight) {mnBackgroundHeight = mnHeight;} ! mnButtonWidth = mpiButtonOn->GetWidth(); ! if (mnButtonWidth > mnWidth) {mnButtonWidth = mnWidth;} //limit dimensions to window ! mnButtonHeight = mpiButtonOn->GetHeight(); ! if (mnButtonHeight > mnHeight) {mnButtonHeight = mnHeight;} ! return true; } /*******************************************************************************/ int tcOptionsView::Draw() { ! static nTestCount = 0; ! static WCHAR szwchar[256]; // wide char array buffer for string conversion ! Graphics *pGraphics; ! Erase(); ! if (!GetGraphics(pGraphics)) { ! return false; ! } ! if (mpiBackground == NULL) {return false;} ! if (mpOptions == NULL) {return false;} ! pGraphics->DrawImage(mpiBackground,0,0,mnWidth,mnHeight); ! ! mpBrush->SetColor(Color(0xFEFFFFFF)); ! ! /*** Draw test text **/ ! ! tcString sText; ! int xpos,ypos; ! ypos = mnYStart; ! RectF rstring; ! for(int i=0;i<mpOptions->mnNumOptions;i++) { ! xpos = mnXStart; ! int nBoxWidth = maButtonPosition[i][mpOptions->maOptionInfo[i].mnStateCount-1].mnButtonX - maButtonPosition[i][0].mnTextX + 2*mnButtonWidth; ! mpBrush->SetColor(Color(0x60FFFFFF)); ! pGraphics->FillRectangle(mpBrush, ! maButtonPosition[i][0].mnTextX - mnButtonHeight/2, ypos - 3*mnButtonHeight/2, ! nBoxWidth, 2*mnButtonHeight); ! mpBrush->SetColor(Color(255,255,220,220)); ! for(int j=0;j<mpOptions->maOptionInfo[i].mnStateCount;j++) { ! sText = mpOptions->maOptionInfo[i].mzCaption[j]; ! MultiByteToWideChar(CP_ACP, 0, sText.GetBuffer(), -1, szwchar, 255); ! pGraphics->MeasureString(szwchar,-1,mpFont,PointF(0,0),&rstring); ! maButtonPosition[i][j].mnTextX = xpos; ! maButtonPosition[i][j].mnTextY = ypos-mnButtonHeight+2; ! xpos += (int)(rstring.Width) + 1; ! maButtonPosition[i][j].mnButtonX = xpos; ! maButtonPosition[i][j].mnButtonY = ypos-mnButtonHeight-mnButtonHeight/6; ! xpos += 3*mnButtonWidth; ! } ! pGraphics->DrawRectangle(mpPen, ! maButtonPosition[i][0].mnTextX - mnButtonHeight/2, ypos - 3*mnButtonHeight/2, ! nBoxWidth, 2*mnButtonHeight); ! ypos += 3*mnButtonHeight; ! } ! ! for(i=0;i<mpOptions->mnNumOptions;i++) { ! for(int j=0;j<mpOptions->maOptionInfo[i].mnStateCount;j++) { ! sText = mpOptions->maOptionInfo[i].mzCaption[j]; ! MultiByteToWideChar(CP_ACP, 0, sText.GetBuffer(), -1, szwchar, 255); ! pGraphics->DrawString(szwchar, -1, mpFont, ! PointF((float)maButtonPosition[i][j].mnTextX, (float)maButtonPosition[i][j].mnTextY), ! mpBrush); ! ! ! if (mpOptions->maOptionInfo[i].mnValue == j) { ! DrawButton(pGraphics,maButtonPosition[i][j].mnButtonX, ! maButtonPosition[i][j].mnButtonY,1); ! } ! else { ! DrawButton(pGraphics,maButtonPosition[i][j].mnButtonX, ! maButtonPosition[i][j].mnButtonY,0); ! } ! } ! } ! ! ReleaseGraphics(pGraphics); ! DrawBorder(); ! return true; } /*******************************************************************************/ void tcOptionsView::DrawButton(Graphics *apGraphics, int x, int y, int abOn) { ! Image *pButton; ! if (apGraphics == NULL) {return;} ! pButton = (abOn == 1) ? mpiButtonOn : mpiButtonOff; ! if (pButton == NULL) {return;} ! apGraphics->DrawImage(pButton,x,y); } /******************************************************************************/ void tcOptionsView::OnLButtonDown(wxMouseEvent& event) { ! bool bButtonClicked; ! int nOption, nValue; ! if (!mbActive) ! { ! event.Skip(); ! return; ! } - // TranslatePoint(point); // adjust for flipped up/down - bButtonClicked = ButtonContainingPoint(event.GetPosition(), nOption, nValue); - if (bButtonClicked) { - if ((nOption >= mpOptions->mnNumOptions)|| - (nValue >= mpOptions->maOptionInfo[nOption].mnStateCount)) { - WTL("tcOptionsView::OnLButtonDown error"); - return; - } - mpOptions->maOptionInfo[nOption].mnValue = nValue; - if (mpOptions->maOptionInfo[nOption].mpAssociated != NULL) { - *mpOptions->maOptionInfo[nOption].mpAssociated = nValue; - } - mpOptions->Serialize(false); // create new options file - if (mpSound != NULL) { - mpSound->PlayEffect(SEFFECT_BEEP2); - } - } - else - { - // switch back to start view if no buttons clicked (for now) - wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_STARTVIEW) ; - command.SetEventObject(this); - AddPendingEvent(command); - } - } /******************************************************************************/ bool tcOptionsView::ButtonContainingPoint(wxPoint point, int& rnOption, int& rnValue) { ! int i,j; ! int nx, ny; ! for(i=0;i<mpOptions->mnNumOptions;i++) { ! for(j=0;j<mpOptions->maOptionInfo[i].mnStateCount;j++) { ! nx = maButtonPosition[i][j].mnButtonX; ! ny = maButtonPosition[i][j].mnButtonY; ! wxRect cr(nx,ny,mnButtonWidth,mnButtonHeight); ! if (cr.Inside(point)) { ! rnOption = i; ! rnValue = j; ! return true; ! } ! } ! } ! return false; } --- 35,246 ---- bool tcOptionsView::Init() { ! char zBuff[96]; ! strcpy(zBuff,IMAGE_PATH); ! strcat(zBuff,"options_bk.jpg"); ! MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); ! mpiBackground = new Image(mzwchar,false); ! strcpy(zBuff,IMAGE_PATH); ! strcat(zBuff,"options_bon.bmp"); ! MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); ! mpiButtonOn = new Image(mzwchar,false); ! strcpy(zBuff,IMAGE_PATH); ! strcat(zBuff,"options_boff.bmp"); ! MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); ! mpiButtonOff = new Image(mzwchar,false); ! if (mpiBackground == NULL) { ! WTL("tcOptions - background bitmap (options_bk.jpg) load error"); ! return false; ! } ! if (mpiButtonOn == NULL) { ! WTL("tcOptions - background bitmap (options_bon.bmp) load error"); ! return false; ! } ! if (mpiButtonOff == NULL) { ! WTL("tcOptions - background bitmap (options_boff.bmp) load error"); ! return false; ! } ! FontFamily ff(L"Arial"); ! mpFont = new Font(&ff,12,FontStyleBold,UnitPixel); ! if (mpFont == NULL) { ! WTL("tcOptionsView - mpFont creation failed\n"); ! return false; ! } ! mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB ! if (mpBrush == NULL) { ! WTL("tcOptionsView - mpBrush creation failed\n"); ! return false; ! } ! mpPen = new Pen(Color(255,200,200,200),2); ! if (mpPen == NULL) { ! WTL("tcTOptionsView - mpPen creation failed\n"); ! return false; ! } ! // Get dimensions and limit to window dimensions ! // mpiButtonOn dimensions are used for all buttons ! mnBackgroundWidth = mpiBackground->GetWidth(); ! if (mnBackgroundWidth > mnWidth) {mnBackgroundWidth = mnWidth;} ! mnBackgroundHeight = mpiBackground->GetHeight(); ! if (mnBackgroundHeight > mnHeight) {mnBackgroundHeight = mnHeight;} ! mnButtonWidth = mpiButtonOn->GetWidth(); ! if (mnButtonWidth > mnWidth) {mnButtonWidth = mnWidth;} //limit dimensions to window ! mnButtonHeight = mpiButtonOn->GetHeight(); ! if (mnButtonHeight > mnHeight) {mnButtonHeight = mnHeight;} ! return true; } /*******************************************************************************/ int tcOptionsView::Draw() { ! static nTestCount = 0; ! static WCHAR szwchar[256]; // wide char array buffer for string conversion ! Graphics *pGraphics; ! Erase(); ! if (!GetGraphics(pGraphics)) { ! return false; ! } ! if (mpiBackground == NULL) {return false;} ! if (mpOptions == NULL) {return false;} ! pGraphics->DrawImage(mpiBackground,0,0,mnWidth,mnHeight); ! mpBrush->SetColor(Color(0xFEFFFFFF)); ! /*** Draw test text **/ ! tcString sText; ! ! ! int xpos,ypos; ! ypos = mnYStart; ! RectF rstring; ! int buttonRowSpacing = (mnWidth < 1000)? (5*mnButtonHeight)/2 : 3*mnButtonHeight; ! ! for(int i=0;i<mpOptions->mnNumOptions;i++) { ! xpos = mnXStart; ! ! int nBoxWidth = maButtonPosition[i][mpOptions->maOptionInfo[i].mnStateCount-1].mnButtonX - maButtonPosition[i][0].mnTextX + 2*mnButtonWidth; ! mpBrush->SetColor(Color(0x60FFFFFF)); ! pGraphics->FillRectangle(mpBrush, ! maButtonPosition[i][0].mnTextX - mnButtonHeight/2, ypos - 3*mnButtonHeight/2, ! nBoxWidth, 2*mnButtonHeight); ! mpBrush->SetColor(Color(255,255,220,220)); ! for(int j=0;j<mpOptions->maOptionInfo[i].mnStateCount;j++) { ! sText = mpOptions->maOptionInfo[i].mzCaption[j]; ! MultiByteToWideChar(CP_ACP, 0, sText.GetBuffer(), -1, szwchar, 255); ! pGraphics->MeasureString(szwchar,-1,mpFont,PointF(0,0),&rstring); ! maButtonPosition[i][j].mnTextX = xpos; ! maButtonPosition[i][j].mnTextY = ypos-mnButtonHeight+2; ! xpos += (int)(rstring.Width) + 1; ! maButtonPosition[i][j].mnButtonX = xpos; ! maButtonPosition[i][j].mnButtonY = ypos-mnButtonHeight-mnButtonHeight/6; ! xpos += 3*mnButtonWidth; ! } ! pGraphics->DrawRectangle(mpPen, ! maButtonPosition[i][0].mnTextX - mnButtonHeight/2, ypos - 3*mnButtonHeight/2, ! nBoxWidth, 2*mnButtonHeight); ! ypos += buttonRowSpacing; ! } ! ! for(i=0;i<mpOptions->mnNumOptions;i++) { ! for(int j=0;j<mpOptions->maOptionInfo[i].mnStateCount;j++) { ! sText = mpOptions->maOptionInfo[i].mzCaption[j]; ! MultiByteToWideChar(CP_ACP, 0, sText.GetBuffer(), -1, szwchar, 255); ! pGraphics->DrawString(szwchar, -1, mpFont, ! PointF((float)maButtonPosition[i][j].mnTextX, (float)maButtonPosition[i][j].mnTextY), ! mpBrush); ! ! ! if (mpOptions->maOptionInfo[i].mnValue == j) { ! DrawButton(pGraphics,maButtonPosition[i][j].mnButtonX, ! maButtonPosition[i][j].mnButtonY,1); ! } ! else { ! DrawButton(pGraphics,maButtonPosition[i][j].mnButtonX, ! maButtonPosition[i][j].mnButtonY,0); ! } ! } ! } ! ! ReleaseGraphics(pGraphics); ! DrawBorder(); ! return true; } /*******************************************************************************/ void tcOptionsView::DrawButton(Graphics *apGraphics, int x, int y, int abOn) { ! Image *pButton; ! if (apGraphics == NULL) {return;} ! pButton = (abOn == 1) ? mpiButtonOn : mpiButtonOff; ! if (pButton == NULL) {return;} ! apGraphics->DrawImage(pButton,x,y); } /******************************************************************************/ void tcOptionsView::OnLButtonDown(wxMouseEvent& event) { ! bool bButtonClicked; ! int nOption, nValue; ! if (!mbActive) ! { ! event.Skip(); ! return; ! } ! ! // TranslatePoint(point); // adjust for flipped up/down ! bButtonClicked = ButtonContainingPoint(event.GetPosition(), nOption, nValue); ! if (bButtonClicked) { ! if ((nOption >= mpOptions->mnNumOptions)|| ! (nValue >= mpOptions->maOptionInfo[nOption].mnStateCount)) { ! WTL("tcOptionsView::OnLButtonDown error"); ! return; ! } ! mpOptions->maOptionInfo[nOption].mnValue = nValue; ! if (mpOptions->maOptionInfo[nOption].mpAssociated != NULL) { ! *mpOptions->maOptionInfo[nOption].mpAssociated = nValue; ! } ! mpOptions->Serialize(false); // create new options file ! if (mpSound != NULL) { ! mpSound->PlayEffect(SEFFECT_BEEP2); ! } ! } ! else ! { ! // switch back to start view if no buttons clicked (for now) ! wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_STARTVIEW) ; ! command.SetEventObject(this); ! AddPendingEvent(command); ! } } /******************************************************************************/ bool tcOptionsView::ButtonContainingPoint(wxPoint point, int& rnOption, int& rnValue) { ! int i,j; ! int nx, ny; ! for(i=0;i<mpOptions->mnNumOptions;i++) { ! for(j=0;j<mpOptions->maOptionInfo[i].mnStateCount;j++) { ! nx = maButtonPosition[i][j].mnButtonX; ! ny = maButtonPosition[i][j].mnButtonY; ! wxRect cr(nx,ny,mnButtonWidth,mnButtonHeight); ! if (cr.Inside(point)) { ! rnOption = i; ! rnValue = j; ! return true; ! } ! } ! } ! return false; } *************** *** 248,282 **** tcOptionsView::tcOptionsView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, ! const wxString& name) : ! tcWindow(parent, pos, size, name) { ! mpiBackground = NULL; ! mpiButtonOn = NULL; ! mpiButtonOff = NULL; ! mpOptions = NULL; ! mpFont = NULL; ! mpBrush = NULL; ! mpSound = NULL; ! mnXStart = 100; ! mnYStart = 100; ! for(int i=0;i<N_OPTIONS;i++) ! { ! for(int k=0;k<N_OPTION_VALUES;k++) ! { ! maButtonPosition[i][k].mnButtonX = -100; ! maButtonPosition[i][k].mnButtonY = -100; ! maButtonPosition[i][k].mnTextX = -100; ! maButtonPosition[i][k].mnTextY = -100; ! } ! } } tcOptionsView::~tcOptionsView() { ! if (mpiBackground != NULL) {delete mpiBackground;} ! if (mpiButtonOn != NULL) {delete mpiButtonOn;} ! if (mpiButtonOff != NULL) {delete mpiButtonOff;} ! if (mpFont != NULL) {delete mpFont;} ! if (mpBrush != NULL) {delete mpBrush;} ! if (mpPen != NULL) {delete mpPen;} } --- 250,284 ---- tcOptionsView::tcOptionsView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, ! const wxString& name) : ! tcWindow(parent, pos, size, name) { ! mpiBackground = NULL; ! mpiButtonOn = NULL; ! mpiButtonOff = NULL; ! mpOptions = NULL; ! mpFont = NULL; ! mpBrush = NULL; ! mpSound = NULL; ! mnXStart = (size.GetWidth() < 1000) ? 60 : 100; ! mnYStart = (size.GetWidth() < 1000) ? 80 : 100; ! for(int i=0;i<N_OPTIONS;i++) ! { ! for(int k=0;k<N_OPTION_VALUES;k++) ! { ! maButtonPosition[i][k].mnButtonX = -100; ! maButtonPosition[i][k].mnButtonY = -100; ! maButtonPosition[i][k].mnTextX = -100; ! maButtonPosition[i][k].mnTextY = -100; ! } ! } } tcOptionsView::~tcOptionsView() { ! if (mpiBackground != NULL) {delete mpiBackground;} ! if (mpiButtonOn != NULL) {delete mpiButtonOn;} ! if (mpiButtonOff != NULL) {delete mpiButtonOff;} ! if (mpFont != NULL) {delete mpFont;} ! if (mpBrush != NULL) {delete mpBrush;} ! if (mpPen != NULL) {delete mpPen;} } Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** tcSound.cpp 1 Jan 2004 23:44:46 -0000 1.10 --- tcSound.cpp 17 Feb 2004 14:27:02 -0000 1.10.2.1 *************** *** 91,95 **** LoadWavDataFromFile("Beep2.wav",SEFFECT_BEEP2); LoadWavDataFromFile("RejectBeep.wav",SEFFECT_REJECTBEEP); ! LoadWavDataFromFile("LightSaber.wav",SEFFECT_LIGHTSABER); LoadWavDataFromFile("Ping.wav",SEFFECT_PING); LoadWavDataFromFile("Ping2.wav",SEFFECT_PING2); --- 91,95 ---- LoadWavDataFromFile("Beep2.wav",SEFFECT_BEEP2); LoadWavDataFromFile("RejectBeep.wav",SEFFECT_REJECTBEEP); ! LoadWavDataFromFile("Ping.wav",SEFFECT_LIGHTSABER); LoadWavDataFromFile("Ping.wav",SEFFECT_PING); LoadWavDataFromFile("Ping2.wav",SEFFECT_PING2); *************** *** 149,153 **** --- 149,159 ---- strcat(zFilePath,azFileName); + fprintf(stdout," Loading effect: %d, wav: %s\n", anEffectID, zFilePath); alutLoadWAVFile((ALbyte*)zFilePath,&format,&wave,&size,&freq,&loop); + if (wave == NULL) + { + fprintf(stderr,"File not found, wav file %s\n",azFileName); + return false; + } if((err=alGetError())!=AL_NO_ERROR) { *************** *** 158,161 **** --- 164,172 ---- alutUnloadWAV(format,wave,size,freq); + if((err=alGetError())!=AL_NO_ERROR) + { + fprintf(stderr,"Error buffering wav file %s\n",azFileName); + return false; + } return true; } |
From: <ddc...@us...> - 2004-02-17 14:35:56
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/src/scriptinterface Modified Files: Tag: v0_5_0 tcPlatformInterface.cpp tcSimPythonInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** tcPlatformInterface.cpp 8 Jan 2004 23:54:27 -0000 1.13 --- tcPlatformInterface.cpp 17 Feb 2004 14:27:02 -0000 1.13.2.1 *************** *** 453,456 **** --- 453,462 ---- // sensor map commands + + /** + * Get first track in alliance sensor map. As a work-around a tcTrackIterator object + * is returned that has the track info along with an index that is used to iterate + * through tracks. This will be simplified in the future. + */ tcTrackIterator tcPlatformInterface::GetFirstTrack(void) { tcTrackIterator t; Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** tcSimPythonInterface.cpp 29 Dec 2003 01:10:25 -0000 1.10 --- tcSimPythonInterface.cpp 17 Feb 2004 14:27:02 -0000 1.10.2.1 *************** *** 46,49 **** --- 46,54 ---- namespace ScriptInterface { + /** + * Adds a menu item with command string + * @param caption caption for menu item + * @param command command string for item + */ void tcMenuInterface::AddItem(std::string caption, std::string command) { *************** *** 51,54 **** --- 56,65 ---- mpMenu->AddItem(caption, command); } + /** + * Adds a menu item with command string and command parameter + * @param caption caption for menu item + * @param command command string for item + * @param param integer command parameter + */ void tcMenuInterface::AddItemWithParam(std::string caption, std::string command, int param) { *************** *** 56,59 **** --- 67,76 ---- mpMenu->AddItem(caption, command, param); } + /** + * Adds a menu item that gets a coordinate or target from the user via a mouse click + * @param caption caption for menu item + * @param callback script to call after user data is obtained + * @param input type of user data: "Heading", "Target", or "Datum" + */ void tcMenuInterface::AddItemUI(std::string caption, std::string callback, std::string input) { *************** *** 61,64 **** --- 78,88 ---- } + /** + * Adds a menu item that gets a coordinate or target from the user via a mouse click + * @param caption caption for menu item + * @param callback script to call after user data is obtained + * @param input type of user data: "Heading", "Target", or "Datum" + * @param param integer callback parameter for additional information + */ void tcMenuInterface::AddItemUIWithParam(std::string caption, std::string callback, std::string input, int param) *************** *** 74,77 **** --- 98,104 ---- } + /** + * Begin a submenu in current menu + */ void tcMenuInterface::BeginSubMenu(void) { if (mpMenu == NULL) {return;} *************** *** 79,82 **** --- 106,112 ---- } + /** + * Clear menu + */ void tcMenuInterface::Clear(void) { if (mpMenu == NULL) {return;} *************** *** 84,87 **** --- 114,120 ---- } + /** + * End submenu in current menu + */ void tcMenuInterface::EndSubMenu(void) { if (mpMenu == NULL) {return;} |
From: <ddc...@us...> - 2004-02-17 14:35:56
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/include/sim Modified Files: Tag: v0_5_0 Game.h tcMapView.h tcObjectControl.h tcStartView.h Log Message: Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -d -r1.22 -r1.22.2.1 *** Game.h 5 Jan 2004 02:48:02 -0000 1.22 --- Game.h 17 Feb 2004 14:27:01 -0000 1.22.2.1 *************** *** 138,141 **** --- 138,142 ---- int mnBriefingWidth; // dimensions of briefing window int mnLeftMargin; // width of left auxiliary windows + int mnLeftMargin2; // width of aux window in second column (hookinfo) int mnBottomMargin; // height of bottom aux windows tcSoundConsole *infoConsole; ///< console object for info messages *************** *** 250,253 **** --- 251,255 ---- void InitializeOptionsView(); void InitializeScenarioSelectView(); + void InitializeScreenSizeParams(const wxSize& screenSize); void InitializeStartView(); void InitializeTacticalMap(); Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMapView.h,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** tcMapView.h 5 Jan 2004 02:48:02 -0000 1.12 --- tcMapView.h 17 Feb 2004 14:27:01 -0000 1.12.2.1 *************** *** 156,161 **** float mfGridSize_rad; float mfGridBaseLon_rad,mfGridBaseLat_rad; ! float mfScale_pelprad; ///< map scale, pixels per radian ! float mfScale_radppel; ///< map scale, radians per pixel std::vector<tcMapObject*> specialGraphics; ///< mission graphics display for now --- 156,163 ---- float mfGridSize_rad; float mfGridBaseLon_rad,mfGridBaseLat_rad; ! float mfScaleX_pelprad; ///< map scale in X, pixels per radian ! float mfScaleX_radppel; ///< map scale in X, radians per pixel ! float mfScaleY_pelprad; ///< map scale in Y, pixels per radian ! float mfScaleY_radppel; ///< map scale in Y, radians per pixel std::vector<tcMapObject*> specialGraphics; ///< mission graphics display for now *************** *** 192,195 **** --- 194,198 ---- tcPoint ScreenToGeo(float x, float y); void SetActive(bool abActive); ///< overrides base class + void SetSize(const wxRect& rect); void SetView(tcPoint center, float afLonSpan); void SetViewCenterZoom(wxPoint pscreen, float afZoom); Index: tcObjectControl.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcObjectControl.h,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** tcObjectControl.h 8 Dec 2003 03:06:36 -0000 1.4 --- tcObjectControl.h 17 Feb 2004 14:27:01 -0000 1.4.2.1 *************** *** 100,104 **** teButtonState maButtonState[MAX_PANELROWS][N_PANELBUTTONS]; ! void Init(int anPanelType); void Draw(Gdiplus::Graphics *apGraphics); void DrawButton(Gdiplus::Graphics *apGraphics, const Gdiplus::RectF& rectf, --- 100,104 ---- teButtonState maButtonState[MAX_PANELROWS][N_PANELBUTTONS]; ! void Init(int anPanelType, int windowWidth); void Draw(Gdiplus::Graphics *apGraphics); void DrawButton(Gdiplus::Graphics *apGraphics, const Gdiplus::RectF& rectf, Index: tcStartView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcStartView.h,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** tcStartView.h 3 Dec 2003 05:50:19 -0000 1.4 --- tcStartView.h 17 Feb 2004 14:27:01 -0000 1.4.2.1 *************** *** 47,50 **** --- 47,51 ---- int mnButtonWidth; int mnButtonHeight; + Gdiplus::Image *mpiButtonOn; Gdiplus::Image *mpiButtonOver; *************** *** 82,85 **** --- 83,87 ---- tsButtonInfo maButton[N_START_BUTTONS]; int mnXStart,mnYStart; + int mnButtonSpacing; tcSound *mpSound; }; |
From: <ddc...@us...> - 2004-02-17 14:35:55
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/include/scriptinterface Modified Files: Tag: v0_5_0 tcPlatformInterface.h tcScenarioInterface.h tcSimPythonInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** tcPlatformInterface.h 8 Jan 2004 23:54:27 -0000 1.11 --- tcPlatformInterface.h 17 Feb 2004 14:27:01 -0000 1.11.2.1 *************** *** 87,113 **** // basic nav commands: heading, speed, altitude float GetAltitude() {return mpPlatformObj->mcKin.mfAlt_m;} float GetFuel() const; ! float GetMaxAltitude() {return mpPlatformObj->mpDBObject->mfMaxAltitude_m;} float GetSpeed() {return mpPlatformObj->mcKin.mfSpeed_kts;} float GetMaxSpeed() {return mpPlatformObj->mpDBObject->mfMaxSpeed_kts;} float GetHeading() {return C_180OVERPI*mpPlatformObj->mcKin.mfHeading_rad;} float GetHeadingRad() {return mpPlatformObj->mcKin.mfHeading_rad;} float GetTerrainElevation(); bool HasThrottle(); ! void SetAltitude(float alt_m) {mpPlatformObj->mcGS.mfGoalAltitude_m = alt_m;} void SetPitchLimitDeg(float lim_deg); void SetSpeed(float speed_kts) {mpPlatformObj->SetSpeed(speed_kts);} ! void SetSpeedToMax(void); void SetThrottle(float throttleFraction); void SetHeading(float heading_deg) {mpPlatformObj->SetHeading(C_PIOVER180*heading_deg);} void SetHeadingRad(float heading_rad) {mpPlatformObj->SetHeading(heading_rad);} float GetHeadingToDatum(float afLon_rad, float afLat_rad); float GetRangeToDatum(float afLon_rad, float afLat_rad); // platform info std::string GetPlatformName(void); std::string GetPlatformClass(void); bool IsSurface() {return (mpPlatformObj->mnModelType == MTYPE_SURFACE);} bool IsAir() { UINT32 nModelType = mpPlatformObj->mnModelType; --- 87,143 ---- // basic nav commands: heading, speed, altitude + /// gets platform altitude in meters float GetAltitude() {return mpPlatformObj->mcKin.mfAlt_m;} + /// gets fraction of fuel remaining from 0 - 1 float GetFuel() const; ! /// gets max altitude in meters indicated in database entry. ! float GetMaxAltitude() {return mpPlatformObj->mpDBObject->mfMaxAltitude_m;} ! /// gets current platform speed in kts float GetSpeed() {return mpPlatformObj->mcKin.mfSpeed_kts;} + /// gets max platform speed indicated in database (only a nominal max for aerodynamic air platforms) float GetMaxSpeed() {return mpPlatformObj->mpDBObject->mfMaxSpeed_kts;} + /// gets current heading in degrees float GetHeading() {return C_180OVERPI*mpPlatformObj->mcKin.mfHeading_rad;} + /// gets current heading in radians float GetHeadingRad() {return mpPlatformObj->mcKin.mfHeading_rad;} + /// gets height of terrain under platform in meters float GetTerrainElevation(); + /// true if platform has a throttle control (aero air models) bool HasThrottle(); ! /// set goal altitude for platform in meters ! /** ! * For air objects ! * @param alt_m goal altitude of platform in meters ! */ ! void SetAltitude(float alt_m) {mpPlatformObj->mcGS.mfGoalAltitude_m = alt_m;} ! /// sets maximum +/- pitch for air objects in degrees, workaround to slow descent for cv landing void SetPitchLimitDeg(float lim_deg); + /// sets speed of platform void SetSpeed(float speed_kts) {mpPlatformObj->SetSpeed(speed_kts);} ! /// set speed of platform to maximum speed (use SetThrottle for aero air objects) ! void SetSpeedToMax(void); ! /// set throttle for air objects ! /** ! * for air objects, sets throttle ! * @param throttleFraction 0 - 1.1, use 0 - 1 for non afterburning throttle, 1.1 for afterburners ! */ void SetThrottle(float throttleFraction); + /// sets heading in degrees void SetHeading(float heading_deg) {mpPlatformObj->SetHeading(C_PIOVER180*heading_deg);} + /// sets heading in radians void SetHeadingRad(float heading_rad) {mpPlatformObj->SetHeading(heading_rad);} + /// get heading to (lon,lat) datum in degrees float GetHeadingToDatum(float afLon_rad, float afLat_rad); + /// get range to (lon,lat) datum in km float GetRangeToDatum(float afLon_rad, float afLat_rad); // platform info + /// get unit name of platform std::string GetPlatformName(void); + /// get database class name of platform std::string GetPlatformClass(void); + /// returns true if platform is a surface platform bool IsSurface() {return (mpPlatformObj->mnModelType == MTYPE_SURFACE);} + /// returns true if platform is an air platform bool IsAir() { UINT32 nModelType = mpPlatformObj->mnModelType; *************** *** 117,176 **** // script variables UINT32 GetVar(int n) {return mpPlatformObj->mcAI.GetVar(n);} void SetVar(int n, UINT32 val) {mpPlatformObj->mcAI.SetVar(n,val);} // target commands void SetTarget(long anID) {mpPlatformObj->mcAI.SetTarget(anID);} long GetTarget(void) {return mpPlatformObj->mcAI.GetTarget();} float GetRangeToTarget(void); tcTrack GetTargetTrackInfo(void); tcGameObject* GetTargetObj(void); bool GetTargetTrack(tcTrack& track); ! bool IsLauncherEffective(int anLauncher); ///< is launcher effective vs. target float SetHeadingToInterceptTarget(void); // weapon related commands ! tcLauncherInfo GetBestLauncher(void); ///< best launcher for target int GetLauncherCount(void); void SendDatumToLauncher(float afLon_rad, float afLat_rad, int anLauncher); bool HandoffTargetToLauncher(int anLauncher); void Launch(int anLauncher, int quantity); std::string GetLauncherWeaponName(int anLauncher); int GetLauncherQuantity(int anLauncher); bool IsDatumLaunch(int anLauncher) {return mpPlatformObj->mcLauncherState.IsDatumLaunch(anLauncher);} bool GetLauncherInfo(tcLauncherInfo& info, int anLauncher); // order related commands bool HasOrders(void); tcOrder GetCurrentOrder(void); void CompletedOrder(void); void AddOrder(std::string order_text, long data = -1); void AddNavOrder(float afLon_rad, float afLat_rad); void ClearOrders(void); void DeleteOrder(int n); int GetOrderCount(); tcOrder GetOrder(int n); // sensor map and sensor commands tcTrackIterator GetFirstTrack(void); int GetTrackCount(void); tcTrackIterator GetNextTrack(long nPos); int GetSensorCount(); tcSensorInfo GetSensorInfo(int n); void SetSensorState(int n, int state); ! void SetAllSensorState(int anState); ///< 0 - off, 1 - on tcTrack GetClosestTrack(float afMaxRange_km, UINT16 anClassMask, UINT8 anAffiliation); tcTrack GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrack GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrack GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrackList GetTrackList(int anClassMask, float afMaxRange_km, UINT8 anAffiliation); float GetInterceptHeadingToTrack(const tcTrack& track); float GetRangeToTrack(const tcTrack& track); float SetHeadingToInterceptTrack(tcTrack track); tcTrack GetTrackById(long id); // flightport (airstrip, cv flight deck, helo pad) bool HasFlightPort(void); tcFlightPortInterface GetFlightPortInfo(void); --- 147,249 ---- // script variables + /// returns user variable n UINT32 GetVar(int n) {return mpPlatformObj->mcAI.GetVar(n);} + /// sets user variable n void SetVar(int n, UINT32 val) {mpPlatformObj->mcAI.SetVar(n,val);} // target commands + /// set target for platform void SetTarget(long anID) {mpPlatformObj->mcAI.SetTarget(anID);} + /// get platform target, -1 for no target long GetTarget(void) {return mpPlatformObj->mcAI.GetTarget();} + /// get range to target in km float GetRangeToTarget(void); + /// get track info object for target tcTrack GetTargetTrackInfo(void); tcGameObject* GetTargetObj(void); bool GetTargetTrack(tcTrack& track); ! /// returns true if launcher is effective vs. current target ! bool IsLauncherEffective(int anLauncher); ! /// if target is valid, sets heading to intercept target. float SetHeadingToInterceptTarget(void); // weapon related commands ! /// gets launcher info object for best launcher for target ! tcLauncherInfo GetBestLauncher(void); ! /// gets number of launchers available on platform int GetLauncherCount(void); + /// sets datum for launcher void SendDatumToLauncher(float afLon_rad, float afLat_rad, int anLauncher); + /// hands off platform target to launcher bool HandoffTargetToLauncher(int anLauncher); + /// orders launch void Launch(int anLauncher, int quantity); + /// get class name of launcher weapon std::string GetLauncherWeaponName(int anLauncher); + /// get quantity available for launch in launcher int GetLauncherQuantity(int anLauncher); + /// true if launcher can launch using datum only (i.e. no track just a set of coordinates) bool IsDatumLaunch(int anLauncher) {return mpPlatformObj->mcLauncherState.IsDatumLaunch(anLauncher);} bool GetLauncherInfo(tcLauncherInfo& info, int anLauncher); // order related commands + + /// true if platform has any orders bool HasOrders(void); + /// gets order info object for current platform order tcOrder GetCurrentOrder(void); + /// called to indicate current order is complete and to move to next order void CompletedOrder(void); + /// adds generic order void AddOrder(std::string order_text, long data = -1); + /// adds navigation order void AddNavOrder(float afLon_rad, float afLat_rad); + /// clear all orders void ClearOrders(void); + /// delete order void DeleteOrder(int n); + /// get total number of orders int GetOrderCount(); + /// get order info object for order n tcOrder GetOrder(int n); // sensor map and sensor commands + /// get first track in alliance sensor map, track iterator object is returned tcTrackIterator GetFirstTrack(void); + /// gets total number of tracks in alliance sensor map int GetTrackCount(void); + /// gets next track in sensor map, nPos is obtained from track iterator from last call tcTrackIterator GetNextTrack(long nPos); + /// gets number of sensors on platform int GetSensorCount(); + /// gets sensor info object for sensor n tcSensorInfo GetSensorInfo(int n); + /// sets state of sensor n, 0 - off, 1 - on void SetSensorState(int n, int state); ! /// sets state of all sensors on platform, 0 - off, 1 - on ! void SetAllSensorState(int anState); ! /// gets track info object for closest track within range that matches classification and affiliation parameters tcTrack GetClosestTrack(float afMaxRange_km, UINT16 anClassMask, UINT8 anAffiliation); + /// gets track info object for closest air track within range matching affiliation tcTrack GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track info object for closest surface track within range matching affiliation tcTrack GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track info object for closest missile track within range matching affiliation tcTrack GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track list object that has all tracks within range matching affiliation tcTrackList GetTrackList(int anClassMask, float afMaxRange_km, UINT8 anAffiliation); + /// get intercept heading to track in radians float GetInterceptHeadingToTrack(const tcTrack& track); + /// get range to track in km float GetRangeToTrack(const tcTrack& track); + /// set heading to intercept track float SetHeadingToInterceptTrack(tcTrack track); + /// get track info object corresponding to track id tcTrack GetTrackById(long id); // flightport (airstrip, cv flight deck, helo pad) + /// true if platform has a flight port (e.g. carrier) bool HasFlightPort(void); tcFlightPortInterface GetFlightPortInfo(void); *************** *** 181,188 **** --- 254,266 ---- void GetUserInput(std::string callback, std::string uitype); void SendCommand(std::string command); + /// display text message in user console void DisplayMessage(std::string text); + /// play sound effect void PlaySound(int n); + /// sets text displayed in platform info panel void SetActionText(std::string text) {mpPlatformObj->mcAI.mzActionText = text;} + /// sets update interval for AI script revisits void SetUpdateInterval(float afInterval) {mpPlatformObj->mcAI.mfUpdateInterval = (afInterval >= 0.25) ? afInterval : 0.25f;} + /// returns a random number between 0 and 1 float GetRand() {return randf();} static void SetObj(tcPlatformObject *apObj) {mpStaticPlatformObj = apObj;} Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** tcScenarioInterface.h 5 Jan 2004 02:48:02 -0000 1.7 --- tcScenarioInterface.h 17 Feb 2004 14:27:01 -0000 1.7.2.1 *************** *** 53,56 **** --- 53,59 ---- }; + /** + * Class to define platform for scenario. + */ class tcScenarioUnit { *************** *** 71,75 **** }; /** ! * Interface class to python scenario generation scripts. */ class tcScenarioInterface --- 74,78 ---- }; /** ! * Interface class for python scenario generation scripts. */ class tcScenarioInterface *************** *** 77,126 **** public: // Interface functions to be called through Python bool AddUnitToAlliance(tcScenarioUnit unit, int alliance); bool AddUnitToFlightDeck(std::string parentName, std::string className, std::string unitName, int locCode); void CreateAlliance(int alliance, std::string name); tcOrder GetDefaultOrder(); tcScenarioUnit GetDefaultUnit(); tcDatum GetRandomDatum(double lon, double lat, float min_alt, float max_alt, float rand_offset); void SetAllianceGoal(int alliance, tcGoal& goal); void SetDateTime(int year, int month, int day, int hour, int min, int sec); void SetScenarioDescription(std::string s); void SetScenarioLoaded(bool state); void SetScenarioName(std::string s); void SetUserAlliance(int alliance); // tcDirector interface functions for briefing events // time/mode events void ClearEvents(); void HookPlatform(std::string unitName); void Pause(); void Resume(); void Set3DMode(int modeCode); void SetBriefingMode(bool state); void SetEventTime(double t); // audio events void PauseAudio(); void PlayAudio(std::string audioName, double seekTime); ! void PlayEffect(int effectNumber); ///< may want to use string for this instead ! void SeekAudio(double seekTime); // text console and map events void ChangeMapView(double lon_deg, double lat_deg, double lonSpan_deg); void ConsoleText(std::string text); void MapText(std::string text, double lon_deg, double lat_deg, double duration, int effect); // camera and 3D events void FlybyCamera(std::string unitName, double duration, float az1_deg, float az2_deg, float el1_deg, float el2_deg, float r1_m, float r2_m); void TrackCamera(std::string unitName, double duration, float x1, float x2, float y1, float y2, float z1, float z2); void Text3D(std::string text, double duration, float x, float y, float size, int effect); // goal class creation methods (cannot find a way to do directly) tcCompoundGoal CompoundGoal(int type); tcTimeGoal TimeGoal(); tcDestroyGoal DestroyGoal(std::string target); --- 80,161 ---- public: // Interface functions to be called through Python + /// Adds unit to alliance bool AddUnitToAlliance(tcScenarioUnit unit, int alliance); + /// Adds unit to flight deck of parent unit bool AddUnitToFlightDeck(std::string parentName, std::string className, std::string unitName, int locCode); + /// Create alliance (side) with name void CreateAlliance(int alliance, std::string name); + /// Get default order object, workaround to create an order object in Python tcOrder GetDefaultOrder(); + /// Get default unit object, workaround to create a unit object in Python tcScenarioUnit GetDefaultUnit(); + /// Gets random datum to place an object at tcDatum GetRandomDatum(double lon, double lat, float min_alt, float max_alt, float rand_offset); + /// Sets top level goal for alliance void SetAllianceGoal(int alliance, tcGoal& goal); + /// Sets date and time for scenario void SetDateTime(int year, int month, int day, int hour, int min, int sec); + /// Sets description string for scenario void SetScenarioDescription(std::string s); + /// Set true to indicate scenario creation is finished and successful void SetScenarioLoaded(bool state); + /// Set name for scenario void SetScenarioName(std::string s); + /// Set alliance of user void SetUserAlliance(int alliance); // tcDirector interface functions for briefing events // time/mode events + /// Clear all director (dynamic briefing) events void ClearEvents(); + /// Hook platform void HookPlatform(std::string unitName); + /// Pause game void Pause(); + /// Resume / unpause game void Resume(); + /// Set 3D display mode: 0 - 3D off, 1 - 3D small, 2 - 3D med, 3 - 3D full void Set3DMode(int modeCode); + /// Set briefing mode: 0 - normal display, 1 - tactical briefing display void SetBriefingMode(bool state); + /// Set time for event, called before event command in script void SetEventTime(double t); // audio events + /// Pause music void PauseAudio(); + /// Play music / audio file, use seek time to play at different locations in file void PlayAudio(std::string audioName, double seekTime); ! /// Play sound effect ! void PlayEffect(int effectNumber); // (may want to use string for this instead) ! /// Jump to different location in music / audio file ! void SeekAudio(double seekTime); // text console and map events + /// change 2D map view center and zoom void ChangeMapView(double lon_deg, double lat_deg, double lonSpan_deg); + /// display console text void ConsoleText(std::string text); + /// display text on map at indicated location, effect codes: 0 - no effect, 1 - fade in/out void MapText(std::string text, double lon_deg, double lat_deg, double duration, int effect); // camera and 3D events + /// flyby 3D camera move void FlybyCamera(std::string unitName, double duration, float az1_deg, float az2_deg, float el1_deg, float el2_deg, float r1_m, float r2_m); + /// tracking camera move void TrackCamera(std::string unitName, double duration, float x1, float x2, float y1, float y2, float z1, float z2); + /// display text on 3D window void Text3D(std::string text, double duration, float x, float y, float size, int effect); // goal class creation methods (cannot find a way to do directly) + /// create compound goal object, type 0 - AND, 1 - OR tcCompoundGoal CompoundGoal(int type); + /// create time goal object tcTimeGoal TimeGoal(); + /// create destroy goal object tcDestroyGoal DestroyGoal(std::string target); Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** tcSimPythonInterface.h 29 Dec 2003 01:10:25 -0000 1.8 --- tcSimPythonInterface.h 17 Feb 2004 14:27:01 -0000 1.8.2.1 *************** *** 44,48 **** namespace ScriptInterface { ! class tcMenuInterface { public: void AddItem(std::string caption, std::string command); --- 44,52 ---- namespace ScriptInterface { ! /** ! * Interface class for creating popup mouse menus. ! */ ! class tcMenuInterface ! { public: void AddItem(std::string caption, std::string command); |
From: <ddc...@us...> - 2004-02-17 14:35:55
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/include/common Modified Files: Tag: v0_5_0 simmath.h tcOptions.h Log Message: Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** simmath.h 8 Jan 2004 23:54:26 -0000 1.6 --- simmath.h 17 Feb 2004 14:27:00 -0000 1.6.2.1 *************** *** 66,69 **** --- 66,70 ---- void Set(float x1,float x2,float y1,float y2); void ApplyBounds(tcGeoRect& r); + bool operator==(const tcGeoRect& r); }; Index: tcOptions.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOptions.h,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** tcOptions.h 9 Dec 2003 00:36:03 -0000 1.4 --- tcOptions.h 17 Feb 2004 14:27:00 -0000 1.4.2.1 *************** *** 56,59 **** --- 56,60 ---- int debugLevel; int renderSkipCount; ///< used to skip rendering of some 2D windows to improve frame rate + int graphicsDetail; tsOptionInfo maOptionInfo[N_OPTIONS]; int mnNumOptions; |
From: <ddc...@us...> - 2004-02-17 14:35:55
|
Update of /cvsroot/gcblue/gcb_wx/res In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/res Modified Files: Tag: v0_5_0 GCblue.rc Log Message: Index: GCblue.rc =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/res/GCblue.rc,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** GCblue.rc 25 Jan 2004 17:36:22 -0000 1.2.2.1 --- GCblue.rc 17 Feb 2004 14:27:01 -0000 1.2.2.2 *************** *** 120,126 **** BLOCK "040904b0" BEGIN ! VALUE "Comments", "Pre-alpha test build, version 0.5.1" VALUE "CompanyName", "Global Conflict Blue Open Source Development" ! VALUE "FileDescription", "Global Conflict Blue Application, version 0.5.1" VALUE "FileVersion", "0, 0, 0, 7" VALUE "InternalName", "GlobalConflict" --- 120,126 ---- BLOCK "040904b0" BEGIN ! VALUE "Comments", "Pre-alpha test build, version 0.5.1c" VALUE "CompanyName", "Global Conflict Blue Open Source Development" ! VALUE "FileDescription", "Global Conflict Blue Application, version 0.5.1c" VALUE "FileVersion", "0, 0, 0, 7" VALUE "InternalName", "GlobalConflict" *************** *** 129,133 **** VALUE "ProductName", "GlobalConflict Blue" VALUE "ProductVersion", "0, 0, 0, 7" ! VALUE "SpecialBuild", "0.5.1" END END --- 129,133 ---- VALUE "ProductName", "GlobalConflict Blue" VALUE "ProductVersion", "0, 0, 0, 7" ! VALUE "SpecialBuild", "0.5.1c" END END |
From: <ddc...@us...> - 2004-02-16 01:14:05
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7358/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtension.cpp tcTrackInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcPlatformInterface.cpp 13 Feb 2004 01:31:33 -0000 1.17 --- tcPlatformInterface.cpp 16 Feb 2004 01:06:23 -0000 1.18 *************** *** 208,217 **** // return false if no track , otherwise true ! bool tcPlatformInterface::GetTargetTrack(tcTrack& track) { tcGameObject* pGameObj = GetTargetObj(); if (pGameObj == NULL) {return false;} // target not found, do nothing // return truth data if own alliance ! if (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->mnAlliance)) { tcKinematics *pTargetKin = &pGameObj->mcKin; track.mfAlt_m = pTargetKin->mfAlt_m; --- 208,219 ---- // return false if no track , otherwise true ! bool tcPlatformInterface::GetTargetTrack(tcSensorMapTrack& track) ! { tcGameObject* pGameObj = GetTargetObj(); if (pGameObj == NULL) {return false;} // target not found, do nothing // return truth data if own alliance ! if (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->mnAlliance)) ! { tcKinematics *pTargetKin = &pGameObj->mcKin; track.mfAlt_m = pTargetKin->mfAlt_m; *************** *** 222,229 **** track.mnClassification = pGameObj->mpDBObject->mnType; track.mnAffiliation = FRIENDLY; return true; } ! else { ! return mpSimState->mcSensorMap.GetTrack(pGameObj->mnID,track,mpPlatformObj->mnAlliance); } } --- 224,246 ---- track.mnClassification = pGameObj->mpDBObject->mnType; track.mnAffiliation = FRIENDLY; + track.engaged.clear(); + track.intercepts.clear(); + track.assessedDamage = pGameObj->mfDamageLevel; return true; } ! else ! { ! tcSensorMapTrack *smtrack = ! mpSimState->mcSensorMap.GetSensorMapTrack(pGameObj->mnID,mpPlatformObj->mnAlliance); ! if (smtrack) ! { ! track = *smtrack; ! return true; ! } ! else ! { ! track.mnID = NULL_INDEX; ! return false; ! } } } *************** *** 237,241 **** return false; } ! tcTrack track; if (GetTargetTrack(track) == false) { return false; --- 254,258 ---- return false; } ! tcSensorMapTrack track; if (GetTargetTrack(track) == false) { return false; *************** *** 253,259 **** } ! tcTrack tcPlatformInterface::GetTargetTrackInfo(void) { ! tcTrack track; ! track.Clear(); GetTargetTrack(track); return track; --- 270,277 ---- } ! tcSensorMapTrack tcPlatformInterface::GetTargetTrackInfo(void) ! { ! tcSensorMapTrack track; ! GetTargetTrack(track); return track; *************** *** 264,269 **** * @return time to intercept in seconds */ ! float tcPlatformInterface::SetHeadingToInterceptTarget() { ! tcTrack track; float fHeading_rad, fTTI; --- 282,288 ---- * @return time to intercept in seconds */ ! float tcPlatformInterface::SetHeadingToInterceptTarget() ! { ! tcSensorMapTrack track; float fHeading_rad, fTTI; *************** *** 275,279 **** } ! float tcPlatformInterface::GetHeadingToDatum(float afLon_rad, float afLat_rad) { tsGeoPoint p; p.mfAlt_m = 0; --- 294,299 ---- } ! float tcPlatformInterface::GetHeadingToDatum(float afLon_rad, float afLat_rad) ! { tsGeoPoint p; p.mfAlt_m = 0; *************** *** 284,288 **** } ! float tcPlatformInterface::GetRangeToDatum(float afLon_rad, float afLat_rad) { tsGeoPoint p; p.mfAlt_m = 0; --- 304,309 ---- } ! float tcPlatformInterface::GetRangeToDatum(float afLon_rad, float afLat_rad) ! { tsGeoPoint p; p.mfAlt_m = 0; *************** *** 295,299 **** // return best launcher for target, best.mnLauncher set to -1 if // no compatible launchers or no target is selected ! tcLauncherInfo tcPlatformInterface::GetBestLauncher() { tcLauncherInfo best; best.mnLauncher = -1; --- 316,321 ---- // return best launcher for target, best.mnLauncher set to -1 if // no compatible launchers or no target is selected ! tcLauncherInfo tcPlatformInterface::GetBestLauncher() ! { tcLauncherInfo best; best.mnLauncher = -1; *************** *** 345,349 **** } ! bool tcPlatformInterface::GetLauncherInfo(tcLauncherInfo& info, int anLauncher) { info.mnLauncher = -1; --- 367,372 ---- } ! bool tcPlatformInterface::GetLauncherInfo(tcLauncherInfo& info, int anLauncher) ! { info.mnLauncher = -1; *************** *** 402,406 **** } ! void tcPlatformInterface::SendDatumToLauncher(float afLon_rad, float afLat_rad, int anLauncher) { tcPoint p; p.x = afLon_rad; --- 425,430 ---- } ! void tcPlatformInterface::SendDatumToLauncher(float afLon_rad, float afLat_rad, int anLauncher) ! { tcPoint p; p.x = afLon_rad; *************** *** 409,413 **** } ! bool tcPlatformInterface::HandoffTargetToLauncher(int anLauncher) { UINT32 nTargetID = mpPlatformObj->mcAI.mnTargetID; bool bAccept = mpSimState->DesignateLauncherTarget(mpPlatformObj->mnID,nTargetID,anLauncher); --- 433,438 ---- } ! bool tcPlatformInterface::HandoffTargetToLauncher(int anLauncher) ! { UINT32 nTargetID = mpPlatformObj->mcAI.mnTargetID; bool bAccept = mpSimState->DesignateLauncherTarget(mpPlatformObj->mnID,nTargetID,anLauncher); *************** *** 425,445 **** } ! int tcPlatformInterface::GetLauncherQuantity(int anLauncher) { return mpPlatformObj->GetLauncherQuantity(anLauncher); } ! bool tcPlatformInterface::HasOrders() { return mpPlatformObj->mcAI.HasOrders(); } ! tcOrder tcPlatformInterface::GetCurrentOrder() { return mpPlatformObj->mcAI.GetCurrentOrder(); } ! void tcPlatformInterface::CompletedOrder() { mpPlatformObj->mcAI.CompletedOrder(); } ! void tcPlatformInterface::AddOrder(std::string order_text, long data) { tcOrder o; o.mstrOrdername = order_text; --- 450,475 ---- } ! int tcPlatformInterface::GetLauncherQuantity(int anLauncher) ! { return mpPlatformObj->GetLauncherQuantity(anLauncher); } ! bool tcPlatformInterface::HasOrders() ! { return mpPlatformObj->mcAI.HasOrders(); } ! tcOrder tcPlatformInterface::GetCurrentOrder() ! { return mpPlatformObj->mcAI.GetCurrentOrder(); } ! void tcPlatformInterface::CompletedOrder() ! { mpPlatformObj->mcAI.CompletedOrder(); } ! void tcPlatformInterface::AddOrder(std::string order_text, long data) ! { tcOrder o; o.mstrOrdername = order_text; *************** *** 448,452 **** } ! void tcPlatformInterface::AddNavOrder(float afLon_rad, float afLat_rad) { tcOrder o; o.mstrOrdername = "Nav"; --- 478,483 ---- } ! void tcPlatformInterface::AddNavOrder(float afLon_rad, float afLat_rad) ! { tcOrder o; o.mstrOrdername = "Nav"; *************** *** 479,483 **** } ! void tcPlatformInterface::GetSensorMap(void) { UINT8 nAlliance = mpPlatformObj->mnAlliance; mpSensorMap = mpSimState->mcSensorMap.GetMap(nAlliance); --- 510,515 ---- } ! void tcPlatformInterface::GetSensorMap(void) ! { UINT8 nAlliance = mpPlatformObj->mnAlliance; mpSensorMap = mpSimState->mcSensorMap.GetMap(nAlliance); *************** *** 486,495 **** // sensor map commands ! tcTrackIterator tcPlatformInterface::GetFirstTrack(void) { tcTrackIterator t; t.mnID = -1; if (mpSensorMap == NULL) {return t;} ! if (mpSensorMap->GetTrackCount()==0) { t.mnID = NULL_INDEX; return t; --- 518,529 ---- // sensor map commands ! tcTrackIterator tcPlatformInterface::GetFirstTrack(void) ! { tcTrackIterator t; t.mnID = -1; if (mpSensorMap == NULL) {return t;} ! if (mpSensorMap->GetTrackCount()==0) ! { t.mnID = NULL_INDEX; return t; *************** *** 499,552 **** } ! int tcPlatformInterface::GetTrackCount(void) { if (mpSensorMap == NULL) {return 0;} return mpSensorMap->GetTrackCount(); } ! tcTrackIterator tcPlatformInterface::GetNextTrack(long nPos) { ! tcTrack *pTrack; tcTrackIterator t; tnPoolIndex nKey = nPos; ! mpSensorMap->GetNextTrack(nKey,pTrack); t.mnKey = nKey; ! tcTrack *pt = (tcTrack*)&t; ! *pt = *pTrack; return t; } ! ! tcTrack tcPlatformInterface::GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation) { ! return GetClosestTrack(afMaxRange_km, PTYPE_AIR, anAffiliation); } ! tcTrack tcPlatformInterface::GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation) { ! return GetClosestTrack(afMaxRange_km, PTYPE_SURFACE, anAffiliation); } ! tcTrack tcPlatformInterface::GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation) { ! return GetClosestTrack(afMaxRange_km, PTYPE_MISSILE, anAffiliation); } // includes unknowns as matches to all affiliations ! tcTrack tcPlatformInterface::GetClosestTrack(float afMaxRange_km, ! UINT16 anClassMask, UINT8 anAffiliation) { ! tcTrack track; ! tcTrack *pTrack; ! track.mnID = NULL_INDEX; if (mpSensorMap == NULL) {return track;} int nCount = mpSensorMap->GetTrackCount(); ! if (nCount==0) { return track; } tnPoolIndex nPos = mpSensorMap->GetStartTrackPosition(); float fMinRange_km = 1e15f; ! for(int n=0;n<nCount;n++) { mpSensorMap->GetNextTrack(nPos, pTrack); bool bAffilMatch = (pTrack->mnAffiliation == anAffiliation) || (pTrack->mnAffiliation == UNKNOWN); ! if ((bAffilMatch)&&(pTrack->mnClassification & anClassMask)) { tsGeoPoint p; --- 533,604 ---- } ! int tcPlatformInterface::GetTrackCount(void) ! { if (mpSensorMap == NULL) {return 0;} return mpSensorMap->GetTrackCount(); } ! tcTrackIterator tcPlatformInterface::GetNextTrack(long nPos) ! { ! tcSensorMapTrack *pSMTrack; tcTrackIterator t; tnPoolIndex nKey = nPos; ! mpSensorMap->GetNextTrack(nKey, pSMTrack); t.mnKey = nKey; ! tcSensorMapTrack *pt = (tcSensorMapTrack*)&t; ! *pt = *pSMTrack; return t; } ! /** ! * @param maxEngagements use 0 to ignore engagement count ! */ ! tcSensorMapTrack tcPlatformInterface::GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation, int maxEngagements) ! { ! return GetClosestTrack(afMaxRange_km, PTYPE_AIR, anAffiliation, maxEngagements); } ! /** ! * @param maxEngagements use 0 to ignore engagement count ! */ ! tcSensorMapTrack tcPlatformInterface::GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation, int maxEngagements) ! { ! return GetClosestTrack(afMaxRange_km, PTYPE_SURFACE, anAffiliation, maxEngagements); } ! /** ! * @param maxEngagements use 0 to ignore engagement count ! */ ! tcSensorMapTrack tcPlatformInterface::GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation, int maxEngagements) ! { ! return GetClosestTrack(afMaxRange_km, PTYPE_MISSILE, anAffiliation, maxEngagements); } // includes unknowns as matches to all affiliations ! /** ! * @param maxEngagements use 0 to ignore engagement count ! */ ! tcSensorMapTrack tcPlatformInterface::GetClosestTrack(float afMaxRange_km, ! UINT16 anClassMask, UINT8 anAffiliation, int maxEngagements) { ! tcSensorMapTrack track; ! tcSensorMapTrack *pTrack; if (mpSensorMap == NULL) {return track;} int nCount = mpSensorMap->GetTrackCount(); ! if (nCount==0) ! { return track; } tnPoolIndex nPos = mpSensorMap->GetStartTrackPosition(); float fMinRange_km = 1e15f; ! for(int n=0;n<nCount;n++) ! { mpSensorMap->GetNextTrack(nPos, pTrack); bool bAffilMatch = (pTrack->mnAffiliation == anAffiliation) || (pTrack->mnAffiliation == UNKNOWN); ! bool engagementsMatch = (maxEngagements == 0) || (pTrack->GetEngagedCount() <= maxEngagements); ! if ((bAffilMatch)&&(pTrack->mnClassification & anClassMask)&&(engagementsMatch)) { tsGeoPoint p; *************** *** 555,559 **** p.mfLon_rad = pTrack->mfLon_rad; float fRange_km = mpPlatformObj->mcKin.RangeToKm(&p); ! if ((fRange_km <= afMaxRange_km)&&(fRange_km < fMinRange_km)) { track = *pTrack; fMinRange_km = fRange_km; --- 607,612 ---- p.mfLon_rad = pTrack->mfLon_rad; float fRange_km = mpPlatformObj->mcKin.RangeToKm(&p); ! if ((fRange_km <= afMaxRange_km)&&(fRange_km < fMinRange_km)) ! { track = *pTrack; fMinRange_km = fRange_km; *************** *** 569,573 **** tcTrackList trackList; ! tcTrack *pTrack; wxASSERT(mpSensorMap); --- 622,626 ---- tcTrackList trackList; ! tcSensorMapTrack *pTrack; wxASSERT(mpSensorMap); *************** *** 606,610 **** * @return intercept heading to track in radians. */ ! float tcPlatformInterface::GetInterceptHeadingToTrack(const tcTrack& track) { float fHeading_rad, fTTI; --- 659,663 ---- * @return intercept heading to track in radians. */ ! float tcPlatformInterface::GetInterceptHeadingToTrack(const tcSensorMapTrack& track) { float fHeading_rad, fTTI; *************** *** 618,622 **** * @return range in km */ ! float tcPlatformInterface::GetRangeToTrack(const tcTrack& track) { wxASSERT(mpPlatformObj); --- 671,675 ---- * @return range in km */ ! float tcPlatformInterface::GetRangeToTrack(const tcSensorMapTrack& track) { wxASSERT(mpPlatformObj); *************** *** 631,635 **** * @return time to intercept in seconds. */ ! float tcPlatformInterface::SetHeadingToInterceptTrack(tcTrack track) { float fHeading_rad, fTTI; --- 684,688 ---- * @return time to intercept in seconds. */ ! float tcPlatformInterface::SetHeadingToInterceptTrack(tcSensorMapTrack track) { float fHeading_rad, fTTI; *************** *** 641,649 **** ! tcTrack tcPlatformInterface::GetTrackById(long id) { ! tcTrack track; - track.mnID = -1; // init to invalid tcGameObject* obj = mpSimState->GetObject(id); if (obj == NULL) return track; // target not found --- 694,701 ---- ! tcSensorMapTrack tcPlatformInterface::GetTrackById(long id) { ! tcSensorMapTrack track; tcGameObject* obj = mpSimState->GetObject(id); if (obj == NULL) return track; // target not found *************** *** 665,670 **** else { ! // returns false if not found ! mpSimState->mcSensorMap.GetTrack(obj->mnID,track,mpPlatformObj->mnAlliance); return track; } --- 717,723 ---- else { ! tcSensorMapTrack *pTrack = ! mpSimState->mcSensorMap.GetSensorMapTrack(obj->mnID, mpPlatformObj->mnAlliance); ! if (pTrack) track = *pTrack; return track; } Index: tcPlatformInterfaceExtension.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtension.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcPlatformInterfaceExtension.cpp 8 Jan 2004 23:54:27 -0000 1.6 --- tcPlatformInterfaceExtension.cpp 16 Feb 2004 01:06:23 -0000 1.7 *************** *** 57,60 **** --- 57,77 ---- ; + object class_smtrack = class_<tcSensorMapTrack>("tcSMTrack") + .def_readonly("Alt",&tcSensorMapTrack::mfAlt_m) + .def_readonly("Lat",&tcSensorMapTrack::mfLat_rad) + .def_readonly("Lon",&tcSensorMapTrack::mfLon_rad) + .def_readonly("Speed",&tcSensorMapTrack::mfSpeed_kts) + .def_readonly("Heading_rad",&tcSensorMapTrack::mfHeading_rad) + .def_readonly("Classification",&tcSensorMapTrack::mnClassification) + .def_readonly("Affiliation",&tcSensorMapTrack::mnAffiliation) + .def_readonly("ID",&tcSensorMapTrack::mnID) + .def("IsAir", &tcSensorMapTrack::IsAir) + .def("IsMissile", &tcSensorMapTrack::IsMissile) + .def("IsSurface", &tcSensorMapTrack::IsSurface) + .def("IsValid", &tcSensorMapTrack::IsValid) + .def("Offset", &tcSensorMapTrack::Offset) + .def("GetEngagedCount", &tcSensorMapTrack::GetEngagedCount) + ; + class_<tcTrackIterator>("TrackIterator") Index: tcTrackInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcTrackInterface.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcTrackInterface.cpp 26 Oct 2003 21:21:17 -0000 1.3 --- tcTrackInterface.cpp 16 Feb 2004 01:06:23 -0000 1.4 *************** *** 38,52 **** namespace ScriptInterface { ! void tcTrackInterface::DropTrack() { if (mpSensorMap == NULL) {return;} mpSensorMap->DropTrack(mnTrackID); } ! void tcTrackInterface::SetAffiliation(UINT8 anAffil) { if (mpSensorMap == NULL) {return;} if (mnTrackID == 0xFFFFFFFF) {return;} tcSensorMapTrack *pSMTrack = mpSensorMap->GetSensorMapTrack(mnTrackID); if (pSMTrack == NULL) {return;} ! pSMTrack->track.mnAffiliation = anAffil; } --- 38,54 ---- namespace ScriptInterface { ! void tcTrackInterface::DropTrack() ! { if (mpSensorMap == NULL) {return;} mpSensorMap->DropTrack(mnTrackID); } ! void tcTrackInterface::SetAffiliation(UINT8 anAffil) ! { if (mpSensorMap == NULL) {return;} if (mnTrackID == 0xFFFFFFFF) {return;} tcSensorMapTrack *pSMTrack = mpSensorMap->GetSensorMapTrack(mnTrackID); if (pSMTrack == NULL) {return;} ! pSMTrack->mnAffiliation = anAffil; } |
From: <ddc...@us...> - 2004-02-16 01:14:05
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7358/scripts Modified Files: AI.py Log Message: Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AI.py 9 Jan 2004 21:48:40 -0000 1.8 --- AI.py 16 Feb 2004 01:06:22 -0000 1.9 *************** *** 50,54 **** def Patrol(UI): targetid = UI.GetTarget() ! if targetid != 0xFFFFFFFF: InterceptTarget(UI) return --- 50,54 ---- def Patrol(UI): targetid = UI.GetTarget() ! if targetid != -1: InterceptTarget(UI) return *************** *** 64,68 **** # engage hostiles in range track_id = GetSuitableTarget(UI) ! if (track_id != 0xFFFFFFFF): UI.SetTarget(track_id) UI.SetHeadingToInterceptTarget() --- 64,68 ---- # engage hostiles in range track_id = GetSuitableTarget(UI) ! if (track_id != -1): UI.SetTarget(track_id) UI.SetHeadingToInterceptTarget() *************** *** 193,209 **** def GetSuitableTarget(UI): ! # first check for air threats ! if (UI.IsAir()): ! # 2nd param is affiliation, 3 is hostile, 0 (unknown) automatically included in search ! track = UI.GetClosestAirTrack(150,3) ! else: # surface ! track = UI.GetClosestAirTrack(50,3) # surface first considers close air tracks ! if (track.IsValid()): ! return track.ID; else: ! track = UI.GetClosestSurfaceTrack(200,3) ! if (track.IsValid()): ! return track.ID; ! return 0xFFFFFFFF; --- 193,210 ---- def GetSuitableTarget(UI): ! air_track = UI.GetClosestAirTrack(150,3,1) ! UI.SetTarget(air_track.ID) # can be -1 ! air_rating = ConsiderTarget(UI) ! ! surface_track = UI.GetClosestSurfaceTrack(200,3,4) # surface first considers surface tracks ! UI.SetTarget(surface_track.ID) ! surface_rating = ConsiderTarget(UI) ! ! if (air_rating > surface_rating): ! return air_track.ID ! elif (surface_rating > 0): ! return surface_track.ID else: ! return -1 *************** *** 220,228 **** return def InterceptTarget(UI): targetid = UI.GetTarget() ! if targetid == 0xFFFFFFFF: return --- 221,248 ---- return + # return 0 if no weapons are available that are effective vs. target + # return 1 if weapon avail, but not in range + # return 2 if weap avail and in range + def ConsiderTarget(UI): + target_id = UI.GetTarget() + if target_id == -1: + return + # check if effective weapon is available + target_info = UI.GetTargetTrackInfo() + launcher_info = UI.GetBestLauncher() + launcher = launcher_info.Launcher + if (launcher == -1): # if (no effective launcher is available) + return 0 + launch_range = launcher_info.Range_km # reference max range, use for launch decision + target_range = UI.GetRangeToTarget() + if (target_range > launch_range): + return 1 + else: + return 2 def InterceptTarget(UI): targetid = UI.GetTarget() ! if targetid == -1: return *************** *** 234,237 **** --- 254,268 ---- UI.SetTarget(-1) # clear target return + + # check how many weapons are engaging target and abort if more than 4 + + # debug_file = open('log/pydebug.txt', 'a') + # debug_file.write('target: %d, engaged: %d\n' % (targetid, target_info.GetEngagedCount()) ) + # debug_file.close() + + if (target_info.GetEngagedCount() > 4): + UI.SetTarget(-1) # clear target + return + # use weapon if in range *************** *** 276,279 **** --- 307,311 ---- lat = target_info.Lat lon = target_info.Lon + UI.HandoffTargetToLauncher(launcher) # to store intended target UI.SendDatumToLauncher(lon,lat,launcher) UI.Launch(launcher, launch_qty) |
From: <ddc...@us...> - 2004-02-16 01:14:05
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7358/src/sim Modified Files: tcGameView.cpp tcSensorMap.cpp tcWeaponObject.cpp Log Message: Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameView.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcGameView.cpp 4 Dec 2003 05:15:22 -0000 1.7 --- tcGameView.cpp 16 Feb 2004 01:06:23 -0000 1.8 *************** *** 605,622 **** int nSize = mpSS->mcSensorMap.GetTrackCount(anAlliance); tnPoolIndex poolpos = mpSS->mcSensorMap.GetStartTrackPosition(anAlliance); ! tcTrack *pTrack, track; int i = 0; ! while((i++<nSize)&&(rnIndex < MAXMAPOBJ)) { ! mpSS->mcSensorMap.GetNextTrack(poolpos,pTrack,anAlliance); ! if (pTrack->mnFlags & TRACK_BEARING_ONLY) { track = *pTrack; tcGameObject *pGameObj = mpSS->GetObject(pTrack->mnPassivePlatformID); ! if (pGameObj != NULL) { track.mfLat_rad = (float)pGameObj->mcKin.mfLat_rad; track.mfLon_rad = (float)pGameObj->mcKin.mfLon_rad; } } ! else { pTrack->GetPrediction(track,afStatusTime); } --- 605,629 ---- int nSize = mpSS->mcSensorMap.GetTrackCount(anAlliance); tnPoolIndex poolpos = mpSS->mcSensorMap.GetStartTrackPosition(anAlliance); ! tcTrack *pTrack; ! tcTrack track; ! tcSensorMapTrack *pSMTrack; int i = 0; ! while((i++<nSize)&&(rnIndex < MAXMAPOBJ)) ! { ! mpSS->mcSensorMap.GetNextTrack(poolpos, pSMTrack, anAlliance); ! pTrack = (tcTrack*)pSMTrack; ! if (pTrack->mnFlags & TRACK_BEARING_ONLY) ! { track = *pTrack; tcGameObject *pGameObj = mpSS->GetObject(pTrack->mnPassivePlatformID); ! if (pGameObj != NULL) ! { track.mfLat_rad = (float)pGameObj->mcKin.mfLat_rad; track.mfLon_rad = (float)pGameObj->mcKin.mfLon_rad; } } ! else ! { pTrack->GetPrediction(track,afStatusTime); } Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSensorMap.cpp 15 Feb 2004 19:47:23 -0000 1.6 --- tcSensorMap.cpp 16 Feb 2004 01:06:23 -0000 1.7 *************** *** 93,97 **** if (weapon) { ! if (!weapon->IsIntendedTarget(track.mnID)) { engaged.erase(engaged.begin() + n); // weapon isn't targeting track --- 93,97 ---- if (weapon) { ! if (!weapon->IsIntendedTarget(tcTrack::mnID)) { engaged.erase(engaged.begin() + n); // weapon isn't targeting track *************** *** 122,126 **** if (platform) { ! if (!platform->IsInterceptingTrack(track.mnID)) { intercepts.erase(intercepts.begin() + n); // platform isn't intercepting track --- 122,126 ---- if (platform) { ! if (!platform->IsInterceptingTrack(tcTrack::mnID)) { intercepts.erase(intercepts.begin() + n); // platform isn't intercepting track *************** *** 198,202 **** // if track already has active data then do not update with passive data ! if (track.mnFlags & TRACK_ACTIVE) {return false;} // search for existing match --- 198,202 ---- // if track already has active data then do not update with passive data ! if (tcTrack::mnFlags & TRACK_ACTIVE) {return false;} // search for existing match *************** *** 228,236 **** tnPoolIndex mnDatabaseID) { ! if (mnClassification != 0) { ! track.mnClassification |= mnClassification; } ! if (meAffiliation != UNKNOWN) { ! track.mnAffiliation = meAffiliation; } } --- 228,238 ---- tnPoolIndex mnDatabaseID) { ! if (mnClassification != 0) ! { ! tcTrack::mnClassification |= mnClassification; } ! if (meAffiliation != UNKNOWN) ! { ! tcTrack::mnAffiliation = meAffiliation; } } *************** *** 239,245 **** // check if reporting sensor has reported, if so update report // if not add new report if slots are free ! bool tcSensorMapTrack::AddReport(const Sensor::tcSensorReport& report) { // search for existing match ! for(int n=0;n<mnContributors;n++) { tcSensorReport *pSensorReport = &maSensorReport[n]; //bool bActivePassiveMatch = (pSensorReport->mnFlags & report.mnFlags & TRACK_BEARING_ONLY); --- 241,249 ---- // check if reporting sensor has reported, if so update report // if not add new report if slots are free ! bool tcSensorMapTrack::AddReport(const Sensor::tcSensorReport& report) ! { // search for existing match ! for(int n=0;n<mnContributors;n++) ! { tcSensorReport *pSensorReport = &maSensorReport[n]; //bool bActivePassiveMatch = (pSensorReport->mnFlags & report.mnFlags & TRACK_BEARING_ONLY); *************** *** 251,255 **** } // add new report if there is room ! if (mnContributors < MAX_SENSOR_REPORTS) { maSensorReport[mnContributors] = report; mnContributors++; --- 255,260 ---- } // add new report if there is room ! if (mnContributors < MAX_SENSOR_REPORTS) ! { maSensorReport[mnContributors] = report; mnContributors++; *************** *** 259,271 **** } ! // check for update reports and update track ! void tcSensorMapTrack::UpdateTrack(void) { bool bUpdated = false; // find first new active report since last update and update track ! for(int n=0;n<mnContributors;n++) { tcSensorReport *pSensorReport = &maSensorReport[n]; if ((!(pSensorReport->mnFlags & (TRACK_BEARING_ONLY|TRACK_TRIANGULATED))) ! &&(pSensorReport->mfTimestamp > track.mfTimestamp)) { int bSpeedValid = (pSensorReport->mnFlags & TRACK_SPEED_VALID) ; --- 264,280 ---- } ! /** ! * check for update reports and update track ! */ ! void tcSensorMapTrack::UpdateTrack(void) ! { bool bUpdated = false; // find first new active report since last update and update track ! for(int n=0;n<mnContributors;n++) ! { tcSensorReport *pSensorReport = &maSensorReport[n]; if ((!(pSensorReport->mnFlags & (TRACK_BEARING_ONLY|TRACK_TRIANGULATED))) ! &&(pSensorReport->mfTimestamp > tcTrack::mfTimestamp)) { int bSpeedValid = (pSensorReport->mnFlags & TRACK_SPEED_VALID) ; *************** *** 273,293 **** int bAltValid = (pSensorReport->mnFlags & TRACK_ALT_VALID); ! track.mnID = pSensorReport->mnTrackID; ! track.mfLat_rad = pSensorReport->mfLat_rad; ! track.mfLon_rad = pSensorReport->mfLon_rad; ! track.mfTimestamp = pSensorReport->mfTimestamp; ! track.mnFlags = TRACK_ACTIVE; ! if (bHeadingValid) { ! track.mfHeading_rad = pSensorReport->mfHeading_rad; ! track.mnFlags |= TRACK_HEADING_VALID; } ! if (bSpeedValid) { ! track.mfSpeed_kts = pSensorReport->mfSpeed_kts; ! track.mnFlags |= TRACK_SPEED_VALID; } ! if (bAltValid) { ! track.mfAlt_m = pSensorReport->mfAlt_m; ! track.mnFlags |= TRACK_ALT_VALID; } return; --- 282,305 ---- int bAltValid = (pSensorReport->mnFlags & TRACK_ALT_VALID); ! tcTrack::mnID = pSensorReport->mnTrackID; ! tcTrack::mfLat_rad = pSensorReport->mfLat_rad; ! tcTrack::mfLon_rad = pSensorReport->mfLon_rad; ! tcTrack::mfTimestamp = pSensorReport->mfTimestamp; ! tcTrack::mnFlags = TRACK_ACTIVE; ! if (bHeadingValid) ! { ! tcTrack::mfHeading_rad = pSensorReport->mfHeading_rad; ! tcTrack::mnFlags |= TRACK_HEADING_VALID; } ! if (bSpeedValid) ! { ! tcTrack::mfSpeed_kts = pSensorReport->mfSpeed_kts; ! tcTrack::mnFlags |= TRACK_SPEED_VALID; } ! if (bAltValid) ! { ! tcTrack::mfAlt_m = pSensorReport->mfAlt_m; ! tcTrack::mnFlags |= TRACK_ALT_VALID; } return; *************** *** 296,315 **** // if the track is passive update with first new passive ! if (track.mnFlags & TRACK_ACTIVE) {return;} ! for(int n=0;n<mnContributors;n++) { tcSensorReport *pSensorReport = &maSensorReport[n]; if ((pSensorReport->mnFlags & (TRACK_BEARING_ONLY | TRACK_TRIANGULATED)) ! &&(pSensorReport->mfTimestamp > track.mfTimestamp)) { ! track.mnID = pSensorReport->mnTrackID; ! track.mfLat_rad = pSensorReport->mfLat_rad; ! track.mfLon_rad = pSensorReport->mfLon_rad; ! track.mfHeading_rad = pSensorReport->mfHeading_rad; ! track.mfSpeed_kts = pSensorReport->mfSpeed_kts; ! track.mfTimestamp = pSensorReport->mfTimestamp; ! track.mnFlags = pSensorReport->mnFlags; ! track.mnPassivePlatformID = pSensorReport->mnSensorPlatformID; return; } --- 308,328 ---- // if the track is passive update with first new passive ! if (tcTrack::mnFlags & TRACK_ACTIVE) {return;} ! for(int n=0;n<mnContributors;n++) ! { tcSensorReport *pSensorReport = &maSensorReport[n]; if ((pSensorReport->mnFlags & (TRACK_BEARING_ONLY | TRACK_TRIANGULATED)) ! &&(pSensorReport->mfTimestamp > tcTrack::mfTimestamp)) { ! tcTrack::mnID = pSensorReport->mnTrackID; ! tcTrack::mfLat_rad = pSensorReport->mfLat_rad; ! tcTrack::mfLon_rad = pSensorReport->mfLon_rad; ! tcTrack::mfHeading_rad = pSensorReport->mfHeading_rad; ! tcTrack::mfSpeed_kts = pSensorReport->mfSpeed_kts; ! tcTrack::mfTimestamp = pSensorReport->mfTimestamp; ! tcTrack::mnFlags = pSensorReport->mnFlags; ! tcTrack::mnPassivePlatformID = pSensorReport->mnSensorPlatformID; return; } *************** *** 319,326 **** } ! // remove report n and shift other reports to fill array from beginning ! void tcSensorMapTrack::RemoveReport(int n) { if ((n<0)||(n>=mnContributors)) {return;} ! for(int k=n+1;k<mnContributors;k++) { maSensorReport[k-1] = maSensorReport[k]; } --- 332,343 ---- } ! /** ! * remove report n and shift other reports to fill array from beginning ! */ ! void tcSensorMapTrack::RemoveReport(int n) ! { if ((n<0)||(n>=mnContributors)) {return;} ! for(int k=n+1;k<mnContributors;k++) ! { maSensorReport[k-1] = maSensorReport[k]; } *************** *** 329,338 **** ! tcSensorMapTrack& tcSensorMapTrack::operator= (tcSensorMapTrack& t) { ! track = t.track; ! for(int i=0;i<MAX_SENSOR_REPORTS;i++) { maSensorReport[i] = t.maSensorReport[i]; } mnContributors = t.mnContributors; return(*this); } --- 346,373 ---- ! tcSensorMapTrack& tcSensorMapTrack::operator= (const tcSensorMapTrack& t) ! { ! *(tcTrack*)this = t ; ! ! mfLastUpdateTime = t.mfLastUpdateTime; ! for(int i=0;i<MAX_SENSOR_REPORTS;i++) ! { maSensorReport[i] = t.maSensorReport[i]; } mnContributors = t.mnContributors; + + for(int j=0;j<MAX_EMITTERS;j++) + { + maEmitterInfo[j] = t.maEmitterInfo[j]; + } + + mnEmitters = t.mnEmitters; + mnDatabaseID = t.mnDatabaseID; + matchupRating = t.matchupRating; + expectedDamage = t.expectedDamage; + assessedDamage = t.assessedDamage; + intercepts = t.intercepts; + engaged = t.engaged; + return(*this); } *************** *** 340,349 **** tcSensorMapTrack::tcSensorMapTrack() { ! track.mnID = NULL_INDEX; ! track.mnAffiliation = 0; ! track.mnAlliance = 0; ! track.mnClassification = 0; ! track.mfTimestamp = 0; ! track.mnFlags = 0; mnEmitters = 0; mnContributors = 0; --- 375,384 ---- tcSensorMapTrack::tcSensorMapTrack() { ! tcTrack::mnID = NULL_INDEX; ! tcTrack::mnAffiliation = 0; ! tcTrack::mnAlliance = 0; ! tcTrack::mnClassification = 0; ! tcTrack::mfTimestamp = 0; ! tcTrack::mnFlags = 0; mnEmitters = 0; mnContributors = 0; *************** *** 356,367 **** } ! tcSensorMapTrack::~tcSensorMapTrack() { } /******************************* tcAllianceSensorMap ****************************/ ! bool tcAllianceSensorMap::AddReport(const Sensor::tcSensorReport& report) { tnPoolIndex nTrackID = report.mnTrackID; tnPoolIndex nIdx = maTrackToSensorTrack[nTrackID]; ! if (nIdx == NULL_INDEX) { tcSensorMapTrack *psmtrack = new tcSensorMapTrack(); tnPoolIndex nKey; --- 391,405 ---- } ! tcSensorMapTrack::~tcSensorMapTrack() ! { } /******************************* tcAllianceSensorMap ****************************/ ! bool tcAllianceSensorMap::AddReport(const Sensor::tcSensorReport& report) ! { tnPoolIndex nTrackID = report.mnTrackID; tnPoolIndex nIdx = maTrackToSensorTrack[nTrackID]; ! if (nIdx == NULL_INDEX) ! { tcSensorMapTrack *psmtrack = new tcSensorMapTrack(); tnPoolIndex nKey; *************** *** 372,378 **** return true; } ! else { tcSensorMapTrack *psmtrack; ! if (maTrack.Lookup(nIdx, psmtrack) == false) { throw "sensor map index corrupt"; } --- 410,418 ---- return true; } ! else ! { tcSensorMapTrack *psmtrack; ! if (maTrack.Lookup(nIdx, psmtrack) == false) ! { throw "sensor map index corrupt"; } *************** *** 452,460 **** } ! void tcAllianceSensorMap::GetNextTrack(tnPoolIndex& pos, tcTrack*& pTrack) { tnPoolIndex nKey; ! tcSensorMapTrack *psmtrack; ! maTrack.GetNextAssoc(pos,nKey,psmtrack); ! pTrack = &psmtrack->track; } --- 492,499 ---- } ! void tcAllianceSensorMap::GetNextTrack(tnPoolIndex& pos, tcSensorMapTrack*& pTrack) ! { tnPoolIndex nKey; ! maTrack.GetNextAssoc(pos, nKey, pTrack); } *************** *** 506,515 **** if (psmtrack->mnContributors <= 0) { ! if (psmtrack->track.mnID >= 0) { ! maTrackToSensorTrack[psmtrack->track.mnID] = NULL_INDEX; // used to be = maTrack.GetPoolSize(); } char zBuff[128]; ! sprintf(zBuff,"Dropped track %d at time %.1f",psmtrack->track.mnID,afStatusTime); WTL(zBuff); #ifdef _DEBUG --- 545,554 ---- if (psmtrack->mnContributors <= 0) { ! if (psmtrack->mnID >= 0) { ! maTrackToSensorTrack[psmtrack->mnID] = NULL_INDEX; // used to be = maTrack.GetPoolSize(); } char zBuff[128]; ! sprintf(zBuff,"Dropped track %d at time %.1f",psmtrack->mnID,afStatusTime); WTL(zBuff); #ifdef _DEBUG *************** *** 547,556 **** if (anTrackID >= MAX_TRACKS) {return NULL;} nMapID = maTrackToSensorTrack[anTrackID]; ! if (nMapID == NULL_INDEX) {return false;} maTrack.Lookup(nMapID,pSMTrack); return pSMTrack; } /*******************************************************************************/ ! bool tcAllianceSensorMap::GetTrack(unsigned long anTrackID, tcTrack& track) { tcSensorMapTrack *pSensorTrack; --- 586,596 ---- if (anTrackID >= MAX_TRACKS) {return NULL;} nMapID = maTrackToSensorTrack[anTrackID]; ! if (nMapID == NULL_INDEX) {return NULL;} maTrack.Lookup(nMapID,pSMTrack); return pSMTrack; } /*******************************************************************************/ ! bool tcAllianceSensorMap::GetTrack(unsigned long anTrackID, tcTrack& track) ! { tcSensorMapTrack *pSensorTrack; *************** *** 558,562 **** return false; } ! track = pSensorTrack->track; return true; } --- 598,602 ---- return false; } ! track = *((tcTrack*)pSensorTrack); return true; } *************** *** 588,596 **** psmtrack = new tcSensorMapTrack; file.Read(psmtrack,sizeof(tcSensorMapTrack)); ! if ((unsigned long)psmtrack->track.mnID >= MAX_TRACKS) { WTL("tcAllianceSensorMap::Serialize - corrupt scenario file"); return false; } ! nKey = maTrackToSensorTrack[psmtrack->track.mnID]; maTrack.AddElementForceKey(psmtrack,nKey); } --- 628,636 ---- psmtrack = new tcSensorMapTrack; file.Read(psmtrack,sizeof(tcSensorMapTrack)); ! if ((unsigned long)psmtrack->mnID >= MAX_TRACKS) { WTL("tcAllianceSensorMap::Serialize - corrupt scenario file"); return false; } ! nKey = maTrackToSensorTrack[psmtrack->mnID]; maTrack.AddElementForceKey(psmtrack,nKey); } *************** *** 639,643 **** return pMap->GetStartTrackPosition(); } ! void tcSensorMap::GetNextTrack(tnPoolIndex& pos, tcTrack*& pTrack, UINT8 anAlliance) { tcAllianceSensorMap *pMap = GetMap(anAlliance); return pMap->GetNextTrack(pos, pTrack); --- 679,683 ---- return pMap->GetStartTrackPosition(); } ! void tcSensorMap::GetNextTrack(tnPoolIndex& pos, tcSensorMapTrack*& pTrack, UINT8 anAlliance) { tcAllianceSensorMap *pMap = GetMap(anAlliance); return pMap->GetNextTrack(pos, pTrack); Index: tcWeaponObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcWeaponObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcWeaponObject.cpp 15 Feb 2004 19:47:23 -0000 1.1 --- tcWeaponObject.cpp 16 Feb 2004 01:06:23 -0000 1.2 *************** *** 40,45 **** if (smtrack == NULL) { ! std::cerr << "tcWeaponObject::SetIntendedTarget - targetId not found in sensor map" ! << std::endl; return; } --- 40,46 ---- if (smtrack == NULL) { ! fprintf(stderr, "tcWeaponObject::SetIntendedTarget - targetId %d not found in sensor map", ! targetId); ! return; } |
From: <ddc...@us...> - 2004-02-16 01:14:05
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7358/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcPlatformInterface.h 15 Feb 2004 19:47:21 -0000 1.15 --- tcPlatformInterface.h 16 Feb 2004 01:06:22 -0000 1.16 *************** *** 22,30 **** #include "tcPlatformObject.h" #include <boost/python.hpp> using namespace boost::python; ! namespace Sensor { class tcAllianceSensorMap; } --- 22,33 ---- #include "tcPlatformObject.h" + #include "tcSensorMap.h" + #include <boost/python.hpp> using namespace boost::python; ! namespace Sensor ! { class tcAllianceSensorMap; } *************** *** 55,60 **** }; ! // wrapper around tcTrack with additional info for iterating ! class tcTrackIterator : public tcTrack { public: long mnKey; --- 58,64 ---- }; ! // wrapper around tcSensorMapTrack with additional info for iterating ! class tcTrackIterator : public tcSensorMapTrack ! { public: long mnKey; *************** *** 64,70 **** { public: ! std::vector<tcTrack> track; ! tcTrack GetTrack(int n) {return track[n];} int Size() {return (int)track.size();} --- 68,74 ---- { public: ! std::vector<tcSensorMapTrack> track; ! tcSensorMapTrack GetTrack(int n) {return track[n];} int Size() {return (int)track.size();} *************** *** 160,166 **** float GetRangeToTarget(void); /// get track info object for target ! tcTrack GetTargetTrackInfo(void); tcGameObject* GetTargetObj(void); ! bool GetTargetTrack(tcTrack& track); /// returns true if launcher is effective vs. current target bool IsLauncherEffective(int anLauncher); --- 164,170 ---- float GetRangeToTarget(void); /// get track info object for target ! tcSensorMapTrack GetTargetTrackInfo(void); tcGameObject* GetTargetObj(void); ! bool GetTargetTrack(tcSensorMapTrack& track); /// returns true if launcher is effective vs. current target bool IsLauncherEffective(int anLauncher); *************** *** 224,245 **** void SetAllSensorState(int anState); /// gets track info object for closest track within range that matches classification and affiliation parameters ! tcTrack GetClosestTrack(float afMaxRange_km, UINT16 anClassMask, ! UINT8 anAffiliation); /// gets track info object for closest air track within range matching affiliation ! tcTrack GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation); /// gets track info object for closest surface track within range matching affiliation ! tcTrack GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation); /// gets track info object for closest missile track within range matching affiliation ! tcTrack GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation); /// gets track list object that has all tracks within range matching affiliation tcTrackList GetTrackList(int anClassMask, float afMaxRange_km, UINT8 anAffiliation); /// get intercept heading to track in radians ! float GetInterceptHeadingToTrack(const tcTrack& track); // get range to track in km ! float GetRangeToTrack(const tcTrack& track); /// set heading to intercept track ! float SetHeadingToInterceptTrack(tcTrack track); /// get track info object corresponding to track id ! tcTrack GetTrackById(long id); // flightport (airstrip, cv flight deck, helo pad) --- 228,252 ---- void SetAllSensorState(int anState); /// gets track info object for closest track within range that matches classification and affiliation parameters ! tcSensorMapTrack GetClosestTrack(float afMaxRange_km, UINT16 anClassMask, ! UINT8 anAffiliation, int maxEngagements); /// gets track info object for closest air track within range matching affiliation ! tcSensorMapTrack GetClosestAirTrack(float afMaxRange_km, ! UINT8 anAffiliation, int maxEngagements); /// gets track info object for closest surface track within range matching affiliation ! tcSensorMapTrack GetClosestSurfaceTrack(float afMaxRange_km, ! UINT8 anAffiliation, int maxEngagements); /// gets track info object for closest missile track within range matching affiliation ! tcSensorMapTrack GetClosestMissileTrack(float afMaxRange_km, ! UINT8 anAffiliation, int maxEngagements); /// gets track list object that has all tracks within range matching affiliation tcTrackList GetTrackList(int anClassMask, float afMaxRange_km, UINT8 anAffiliation); /// get intercept heading to track in radians ! float GetInterceptHeadingToTrack(const tcSensorMapTrack& track); // get range to track in km ! float GetRangeToTrack(const tcSensorMapTrack& track); /// set heading to intercept track ! float SetHeadingToInterceptTrack(tcSensorMapTrack track); /// get track info object corresponding to track id ! tcSensorMapTrack GetTrackById(long id); // flightport (airstrip, cv flight deck, helo pad) |
From: <ddc...@us...> - 2004-02-16 01:14:05
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7358/include/sim Modified Files: tcSensorMap.h Log Message: Index: tcSensorMap.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorMap.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSensorMap.h 15 Feb 2004 19:47:22 -0000 1.4 --- tcSensorMap.h 16 Feb 2004 01:06:22 -0000 1.5 *************** *** 74,82 **** * engageRating controls how much ordance */ ! class tcSensorMapTrack { enum {MAX_SENSOR_REPORTS = 2, MAX_EMITTERS = 4}; public: ! tcTrack track; double mfLastUpdateTime; tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; // most recent data from contributing sensors --- 74,82 ---- * engageRating controls how much ordance */ ! class tcSensorMapTrack : public tcTrack { enum {MAX_SENSOR_REPORTS = 2, MAX_EMITTERS = 4}; public: ! //tcTrack track; double mfLastUpdateTime; tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; // most recent data from contributing sensors *************** *** 114,119 **** unsigned GetInterceptCount() const; ! const tcTrack* GetTrack() {return &track;} ! bool IsNew() {return track.mfTimestamp == 0;} --- 114,119 ---- unsigned GetInterceptCount() const; ! const tcTrack* GetTrack() {return this;} ! bool IsNew() {return mfTimestamp == 0;} *************** *** 133,137 **** tcSensorMapTrack* operator= (tcSensorMapTrack *pa) {return pa;} ! tcSensorMapTrack& operator= (tcSensorMapTrack&); tcSensorMapTrack(); ~tcSensorMapTrack(); --- 133,137 ---- tcSensorMapTrack* operator= (tcSensorMapTrack *pa) {return pa;} ! tcSensorMapTrack& operator= (const tcSensorMapTrack&); tcSensorMapTrack(); ~tcSensorMapTrack(); *************** *** 150,154 **** int GetTrackCount(void); tnPoolIndex GetStartTrackPosition(void); ! void GetNextTrack(tnPoolIndex& pos, tcTrack*& pTrack); void Clear(void); void DropTrack(tnPoolIndex anID); --- 150,154 ---- int GetTrackCount(void); tnPoolIndex GetStartTrackPosition(void); ! void GetNextTrack(tnPoolIndex& pos, tcSensorMapTrack*& pTrack); void Clear(void); void DropTrack(tnPoolIndex anID); *************** *** 179,183 **** int GetTrackCount(UINT8 anAlliance); tnPoolIndex GetStartTrackPosition(UINT8 anAlliance); ! void GetNextTrack(tnPoolIndex& pos, tcTrack*& pTrack, UINT8 anAlliance); tcAllianceSensorMap* GetMap(UINT8 anAlliance); --- 179,183 ---- int GetTrackCount(UINT8 anAlliance); tnPoolIndex GetStartTrackPosition(UINT8 anAlliance); ! void GetNextTrack(tnPoolIndex& pos, tcSensorMapTrack*& pTrack, UINT8 anAlliance); tcAllianceSensorMap* GetMap(UINT8 anAlliance); |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8158/src/sim Modified Files: Game.cpp tcGameObject.cpp tcHookInfo.cpp tcMissileObject.cpp tcPlatformObject.cpp tcSensorMap.cpp tcSimState.cpp Added Files: tcWeaponObject.cpp Log Message: --- NEW FILE: tcWeaponObject.cpp --- /** @file tcWeaponObject.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 "tcWeaponObject.h" #include "tcGameObject.h" #include "tcDatabaseObject.h" #include "tcSensorMap.h" #include "tcSimState.h" bool tcWeaponObject::IsIntendedTarget(long id) { if (id == -1) return false; return intendedTarget == id; } void tcWeaponObject::SetIntendedTarget(long targetId) { using namespace Sensor; intendedTarget = targetId; if (targetId == -1) return; tcSensorMapTrack *smtrack = simState->mcSensorMap.GetSensorMapTrack(targetId, tcGameObject::mnAlliance); if (smtrack == NULL) { std::cerr << "tcWeaponObject::SetIntendedTarget - targetId not found in sensor map" << std::endl; return; } smtrack->AddEngagement(tcGameObject::mnID); } /** * */ tcWeaponObject::tcWeaponObject() { intendedTarget = -1; } /** * Copy constructor. */ tcWeaponObject::tcWeaponObject(tcWeaponObject& o) { wxASSERT(false); // not supported } /** * Constructor that initializes using info from database entry. */ tcWeaponObject::tcWeaponObject(tcDatabaseObject *obj) : tcGameObject(obj) { wxASSERT(simState); intendedTarget = -1; } /** * */ tcWeaponObject::~tcWeaponObject() { } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Game.cpp 13 Feb 2004 01:31:33 -0000 1.58 --- Game.cpp 15 Feb 2004 19:47:23 -0000 1.59 *************** *** 1194,1200 **** if (!bResult) { ! wxMessageBox("Error - high performance counter"); ! return true; ! } nLastCount = nPerformanceCount.QuadPart; --- 1194,1200 ---- if (!bResult) { ! wxMessageBox("Error - high performance counter"); ! return true; ! } nLastCount = nPerformanceCount.QuadPart; *************** *** 1202,1211 **** fdt = (1.0f/30.0f); ! snStartCount = nPerformanceCount; if (mcOptions.debugLevel > 0) ! { ! wxMessageBox("UpdateFrame(game mode) init2\n"); ! } } --- 1202,1211 ---- fdt = (1.0f/30.0f); ! snStartCount = nPerformanceCount; if (mcOptions.debugLevel > 0) ! { ! wxMessageBox("UpdateFrame(game mode) init2\n"); ! } } *************** *** 1224,1228 **** gameTime = mcSimState.GetTime(); mcSimState.GetDateZulu(gameDateZulu); ! if (!mbPaused) { gameTime += fdt; --- 1224,1228 ---- gameTime = mcSimState.GetTime(); mcSimState.GetDateZulu(gameDateZulu); ! if (!mbPaused) { gameTime += fdt; *************** *** 1260,1264 **** viewer->SetGameTime(gameTime); ! if (mbScenarioEdit) { tacticalMap->mnGameMode = GAMEMODE_EDIT; --- 1260,1264 ---- viewer->SetGameTime(gameTime); ! if (mbScenarioEdit) { tacticalMap->mnGameMode = GAMEMODE_EDIT; *************** *** 1276,1279 **** --- 1276,1280 ---- } + if (mbSaveScenario) { Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcGameObject.cpp 10 Jan 2004 21:55:31 -0000 1.9 --- tcGameObject.cpp 15 Feb 2004 19:47:23 -0000 1.10 *************** *** 28,34 **** --- 28,36 ---- #include "tcDatabase.h" #include "tc3DModel.h" + #include "tcSimState.h" tcMapData* tcGameObject::mapData = NULL; Database::tcDatabase* tcGameObject::database = NULL; + tcSimState* tcGameObject::simState = NULL; /** *************** *** 303,307 **** /** ! * initializes using database object. Database must be set * before using this method. * @see SetGameObjectDatabase --- 305,309 ---- /** ! * initializes using database object. database and simState must be set * before using this method. * @see SetGameObjectDatabase *************** *** 310,313 **** --- 312,316 ---- { wxASSERT(database); + wxASSERT(simState); wxASSERT(obj); Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcHookInfo.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcHookInfo.cpp 8 Dec 2003 03:06:36 -0000 1.7 --- tcHookInfo.cpp 15 Feb 2004 19:47:23 -0000 1.8 *************** *** 24,27 **** --- 24,29 ---- #endif + #include <wx/string.h> + #include "tcHookInfo.h" #include "aerror.h" *************** *** 40,44 **** } ! void tcHookInfo::DrawTrack(Graphics *apGraphics, tnPoolIndex anID) { tcSensorMapTrack *pSMTrack; --- 42,50 ---- } ! /** ! * Draw hook info display when track is hooked (vs. own-alliance platform) ! */ ! // This method needs to be broken up ! void tcHookInfo::DrawTrack(Gdiplus::Graphics *apGraphics, tnPoolIndex anID) { tcSensorMapTrack *pSMTrack; *************** *** 125,131 **** } } ! void tcHookInfo::DrawOwn(Graphics *apGraphics, tcGameObject *pHookedObj) { std::string s; --- 131,228 ---- } + //*********** draw engagement info ************** + DrawTrackEngaged(apGraphics, pSMTrack, ftextx, ftexty); + } ! /** ! * Draws list of weapons that have engaged track. ! * For drawEngageMode = 0 draws a list of IDs, ! * for drawEngageMode = 1 draws class name and quantity ! * x and y are start coordinates of drawing text. ! * x and y are modified by this method so that other ! * drawing methods can draw underneath. ! */ ! void tcHookInfo::DrawTrackEngaged(Gdiplus::Graphics *graphics, ! const Sensor::tcSensorMapTrack *smtrack, float& x, float& y) ! { ! char zBuff[128]; ! SizeF textSize; ! ! int nEngaged = (int)smtrack->GetEngagedCount(); ! if (nEngaged) ! { ! ! DrawText(graphics,mpFont,mpBrush,"Engaged with: ",x,y); ! MeasureText(graphics, mpFont, "Engaged with: ", textSize); ! } ! ! if (drawEngagedMode == 0) ! { ! x += textSize.Width + 3.0f; ! for (int nE=0;nE<nEngaged;nE++) ! { ! sprintf(zBuff,"%d ",smtrack->engaged[nE]); ! DrawText(graphics,mpFont,mpBrush,zBuff,x,y); ! MeasureText(graphics, mpFont, zBuff, textSize); ! x += textSize.Width + 2.0f; ! if (x > (float) mnWidth - 10.0f) ! { ! x = 20.0f; ! y += 15; ! } ! } ! y+=15; ! return; ! } ! ! std::vector<long> classID; ! std::vector<unsigned> quantity; ! wxArrayString className; ! ! for (int nE=0;nE<nEngaged;nE++) ! { ! long id; ! wxString name; ! ! if (tcGameObject *obj = mpSS->GetObject(smtrack->engaged[nE])) ! { ! id = obj->mnDBKey; ! name = obj->mpDBObject->mzClass.mz; ! } ! else ! { ! id = -1; ! name = "Error"; ! } ! bool matches = false; ! for(unsigned k=0;(k<classID.size())&&(!matches);k++) ! { ! if (classID[k] == id) ! { ! matches = true; ! quantity[k]++; ! } ! } ! if (!matches) ! { ! classID.push_back(id); ! quantity.push_back(1); ! className.Add(name); ! } ! } ! ! y += 15; ! for (unsigned k=0;k<classID.size();k++) ! { ! sprintf(zBuff," %s (%d)", className[k].c_str(), quantity[k]); ! DrawText(graphics, mpFont, mpBrush, zBuff, x, y); ! MeasureText(graphics, mpFont, zBuff, textSize); ! y += textSize.Height + 2.0f; ! } ! ! } ! ! void tcHookInfo::DrawOwn(Gdiplus::Graphics *apGraphics, tcGameObject *pHookedObj) { std::string s; *************** *** 404,407 **** --- 501,505 ---- mpOptions = NULL; mpUserInfo = NULL; + drawEngagedMode = 1; mpPen = new Pen(Color(0xFEFFFFFF),2); Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcMissileObject.cpp 13 Feb 2004 01:31:33 -0000 1.7 --- tcMissileObject.cpp 15 Feb 2004 19:47:23 -0000 1.8 *************** *** 142,145 **** --- 142,150 ---- mcSensorState.mfCurrentScanPeriod_s = 0.2f; } + else if (tti_s <= 2.0f) + { + mfGuidanceUpdateInterval = 0.1f; + mcSensorState.mfCurrentScanPeriod_s = 0.1f; + } *************** *** 358,361 **** --- 363,367 ---- */ tcMissileObject::tcMissileObject() + : tcWeaponObject() { Clear(); *************** *** 375,378 **** --- 381,385 ---- */ tcMissileObject::tcMissileObject(tcMissileObject& o) + : tcWeaponObject(o) { mnModelType = MTYPE_MISSILE; *************** *** 394,398 **** */ tcMissileObject::tcMissileObject(tcMissileDBObject *obj) ! : tcGameObject(obj) { mpDBObject = obj; --- 401,405 ---- */ tcMissileObject::tcMissileObject(tcMissileDBObject *obj) ! : tcWeaponObject(obj) { mpDBObject = obj; Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcPlatformObject.cpp 13 Feb 2004 01:31:33 -0000 1.17 --- tcPlatformObject.cpp 15 Feb 2004 19:47:23 -0000 1.18 *************** *** 259,262 **** --- 259,273 ---- return false; } + + /** + * @return true if platform is intercepting (has targeted) track with id + */ + bool tcPlatformObject::IsInterceptingTrack(long id) + { + wxASSERT(id >= 0); + + return mcAI.GetTarget() == id; + } + /******************************************************************************/ // consider only active radars Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSensorMap.cpp 13 Feb 2004 01:31:33 -0000 1.5 --- tcSensorMap.cpp 15 Feb 2004 19:47:23 -0000 1.6 *************** *** 25,28 **** --- 25,30 ---- #include "aerror.h" #include "simmath.h" + #include "tcSimState.h" + #include "tcWeaponObject.h" using namespace Sensor; *************** *** 30,119 **** [...1348 lines suppressed...] ! return true; } tcSensorMap::tcSensorMap() { ! for(int n=0;n<MAX_MAPS;n++) { ! mapMap[n] = NULL; ! } ! mnMaps = 0; ! Clear(); } tcSensorMap::~tcSensorMap() { ! for(int n=0;n<MAX_MAPS;n++) { ! if (mapMap[n] != NULL) { ! delete mapMap[n]; ! } ! } } \ No newline at end of file Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcSimState.cpp 13 Feb 2004 01:31:33 -0000 1.33 --- tcSimState.cpp 15 Feb 2004 19:47:23 -0000 1.34 *************** *** 1209,1217 **** } // add heading and pitch initializers eventually, have to deal with launcher angle pnew = static_cast<tcGameObject*>(pMissileObj); - - pnew->mfStatusTime = plaunchingplatform->mfStatusTime; pnew->mcKin = plaunchingplatform->mcKin; --- 1209,1216 ---- } + // add heading and pitch initializers eventually, have to deal with launcher angle pnew = static_cast<tcGameObject*>(pMissileObj); pnew->mfStatusTime = plaunchingplatform->mfStatusTime; pnew->mcKin = plaunchingplatform->mcKin; *************** *** 1223,1227 **** --- 1222,1231 ---- pnew->mzUnit = s.GetBuffer(); pnew->mnAlliance = plaunchingplatform->mnAlliance; + AddPlatform(pnew); + + // set intended target (has to be done after alliance and id is set) + pMissileObj->SetIntendedTarget(pLauncher->mnTargetID); + if (mpUserInfo->IsOwnAlliance(plaunchingplatform->mnAlliance)) { *************** *** 1796,1799 **** --- 1800,1805 ---- tcSensorState::AttachSimState(this); tcGameObjIterator::SetSimState(this); + tcGameObject::SetSimState(this); + tcSensorMapTrack::AttachSimState(this); mcSensorMap.CreateMapForAlliance(1); |
From: <ddc...@us...> - 2004-02-15 19:54:53
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8158/src/scriptinterface Modified Files: tcSimPythonInterface.cpp Log Message: Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcSimPythonInterface.cpp 29 Jan 2004 00:05:26 -0000 1.11 --- tcSimPythonInterface.cpp 15 Feb 2004 19:47:22 -0000 1.12 *************** *** 46,49 **** --- 46,54 ---- namespace ScriptInterface { + /** + * Adds a menu item with command string + * @param caption caption for menu item + * @param command command string for item + */ void tcMenuInterface::AddItem(std::string caption, std::string command) { *************** *** 51,54 **** --- 56,65 ---- mpMenu->AddItem(caption, command); } + /** + * Adds a menu item with command string and command parameter + * @param caption caption for menu item + * @param command command string for item + * @param param integer command parameter + */ void tcMenuInterface::AddItemWithParam(std::string caption, std::string command, int param) { *************** *** 56,59 **** --- 67,76 ---- mpMenu->AddItem(caption, command, param); } + /** + * Adds a menu item that gets a coordinate or target from the user via a mouse click + * @param caption caption for menu item + * @param callback script to call after user data is obtained + * @param input type of user data: "Heading", "Target", or "Datum" + */ void tcMenuInterface::AddItemUI(std::string caption, std::string callback, std::string input) { *************** *** 61,64 **** --- 78,88 ---- } + /** + * Adds a menu item that gets a coordinate or target from the user via a mouse click + * @param caption caption for menu item + * @param callback script to call after user data is obtained + * @param input type of user data: "Heading", "Target", or "Datum" + * @param param integer callback parameter for additional information + */ void tcMenuInterface::AddItemUIWithParam(std::string caption, std::string callback, std::string input, int param) *************** *** 74,77 **** --- 98,104 ---- } + /** + * Begin a submenu in current menu + */ void tcMenuInterface::BeginSubMenu(void) { if (mpMenu == NULL) {return;} *************** *** 79,82 **** --- 106,112 ---- } + /** + * Clear menu + */ void tcMenuInterface::Clear(void) { if (mpMenu == NULL) {return;} *************** *** 84,87 **** --- 114,120 ---- } + /** + * End submenu in current menu + */ void tcMenuInterface::EndSubMenu(void) { if (mpMenu == NULL) {return;} |
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8158/include/sim Modified Files: tcAIData.h tcGameObject.h tcHookInfo.h tcMissileObject.h tcPlatformObject.h tcSensorMap.h Added Files: tcWeaponObject.h Log Message: --- NEW FILE: tcWeaponObject.h --- /** @file tcWeaponObject.h */ /* * 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 */ #pragma once #ifndef _TCWEAPONOBJECT_H_ #define _TCWEAPONOBJECT_H_ #include "tcGameObject.h" namespace Database { class tcDatabaseObject; } /** * Base class for weapons, e.g. missiles, bombs, gun rounds. * * @see tcGameObject */ class tcWeaponObject : public tcGameObject { public: /// returns true if id is intended target of this weapon bool IsIntendedTarget(long id); /// sets intended target void SetIntendedTarget(long targetId); protected: long intendedTarget; tcWeaponObject(); tcWeaponObject(tcWeaponObject&); tcWeaponObject(tcDatabaseObject *obj); ~tcWeaponObject(); }; #endif Index: tcAIData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAIData.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcAIData.h 7 Feb 2004 02:19:54 -0000 1.5 --- tcAIData.h 15 Feb 2004 19:47:21 -0000 1.6 *************** *** 61,69 **** unsigned mnCurrentOrder; ! UINT32 mnScriptVar[N_VAR]; // variables for use in scripts ! UINT32 mnTargetID; // target for AI engagements ! double mfNextUpdate; // time for next update of AI ! float mfUpdateInterval; // interval for AI updates ! std::string mzActionText; // text for script to set to describe current platform action // order methods --- 61,69 ---- unsigned mnCurrentOrder; ! UINT32 mnScriptVar[N_VAR]; ///< variables for use in scripts ! long mnTargetID; ///< target for AI engagements ! double mfNextUpdate; ///< time for next update of AI ! float mfUpdateInterval; ///< interval for AI updates ! std::string mzActionText; ///< text for script to set to describe current platform action // order methods *************** *** 88,93 **** void ClearVars(); void GetActionText(std::string& text) {text = mzActionText;} ! void SetTarget(UINT32 anId) {mnTargetID = anId;} ! UINT32 GetTarget(void) {return mnTargetID;} // long to work better with Python void ClearTarget(void) {mnTargetID = NULL_INDEX;} --- 88,93 ---- void ClearVars(); void GetActionText(std::string& text) {text = mzActionText;} ! void SetTarget(long anId) {mnTargetID = anId;} ! long GetTarget(void) {return mnTargetID;} // long to work better with Python void ClearTarget(void) {mnTargetID = NULL_INDEX;} Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcGameObject.h 13 Feb 2004 01:31:32 -0000 1.13 --- tcGameObject.h 15 Feb 2004 19:47:21 -0000 1.14 *************** *** 39,42 **** --- 39,45 ---- class tcDatabase; } + + class tcSimState; + /** * 3D model coordinates relative to parent frame of *************** *** 123,126 **** --- 126,130 ---- static void SetGameObjectDatabase(Database::tcDatabase *db) {database = db;} static void SetGameObjectMapData(tcMapData *md) {mapData = md;} + static void SetSimState(tcSimState *ss) {simState = ss;} const tcGameObject* operator= (const tcGameObject *p) {return p;} tcGameObject(); *************** *** 131,134 **** --- 135,139 ---- static tcMapData *mapData; static Database::tcDatabase *database; + static tcSimState *simState; }; #endif \ No newline at end of file Index: tcHookInfo.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcHookInfo.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcHookInfo.h 7 Feb 2004 02:19:54 -0000 1.4 --- tcHookInfo.h 15 Feb 2004 19:47:22 -0000 1.5 *************** *** 41,44 **** --- 41,49 ---- class tcDatabaseObject; } + namespace Sensor + { + class tcSensorMapTrack; + } + using namespace Database; *************** *** 56,59 **** --- 61,65 ---- void AttachOptions(tcOptions *apOptions) {mpOptions = apOptions;} void AttachUserInfo(tcUserInfo *apUserInfo) {mpUserInfo=apUserInfo;} + void SetEngagedDrawMode(int mode) {drawEngagedMode = mode;} void SetHookID(tnPoolIndex anID) {mnHookID=anID;} void OnLButtonDown(wxMouseEvent& event); *************** *** 63,66 **** --- 69,73 ---- virtual ~tcHookInfo(); private: + int drawEngagedMode; ///< = 1 to draw engaged by class name and quantity, 0 for id's tcSimState *mpSS; ///< pointer to SimState object to access hook info, change this ///< to a UserSimState reference when ready (state as known by user's side) *************** *** 73,76 **** --- 80,85 ---- Gdiplus::Font *mpFont, *mpFontLarge; + void DrawTrackEngaged(Gdiplus::Graphics *graphics, + const Sensor::tcSensorMapTrack *smtrack, float& x, float& y); void GetFunctionalName(std::string& s, tcDatabaseObject *apDBObject, tcGameObject *apGameObject); void GetObjectInfo(std::string& s, tcDatabaseObject *apDBObject, tcGameObject *apGameObject); Index: tcMissileObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMissileObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcMissileObject.h 13 Feb 2004 01:31:32 -0000 1.5 --- tcMissileObject.h 15 Feb 2004 19:47:22 -0000 1.6 *************** *** 24,28 **** #include "tcAero.h" ! #include "tcGameObject.h" #include "tcGuidanceState.h" #include "tcRadar.h" --- 24,28 ---- #include "tcAero.h" ! #include "tcWeaponObject.h" #include "tcGuidanceState.h" #include "tcRadar.h" *************** *** 35,39 **** * @see tcGameObject */ ! class tcMissileObject : public tcGameObject { public: --- 35,39 ---- * @see tcGameObject */ ! class tcMissileObject : public tcWeaponObject { public: Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcPlatformObject.h 13 Feb 2004 01:31:32 -0000 1.12 --- tcPlatformObject.h 15 Feb 2004 19:47:22 -0000 1.13 *************** *** 65,68 **** --- 65,69 ---- // virtual void GetSensorStateRef(tcSensorState**& rapSensorState, int& rnCount); virtual bool HasActivatedSensor(void); + virtual bool IsInterceptingTrack(long id); virtual bool IsRadiating(void); virtual std::vector<tcSensorState*>* GetSensorStateArray(void) {return &mapSensorState;} Index: tcSensorMap.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorMap.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSensorMap.h 13 Feb 2004 01:31:32 -0000 1.3 --- tcSensorMap.h 15 Feb 2004 19:47:22 -0000 1.4 *************** *** 19,24 **** ! #if !defined(AFX_TCSENSORMAP_H__57EE0C2E_4C78_4B79_87F1_4770F3E989A9__INCLUDED_) ! #define AFX_TCSENSORMAP_H__57EE0C2E_4C78_4B79_87F1_4770F3E989A9__INCLUDED_ #if _MSC_VER > 1000 --- 19,24 ---- ! #ifndef _SENSORMAP_H_ ! #define _SENSORMAP_H_ #if _MSC_VER > 1000 *************** *** 31,34 **** --- 31,36 ---- #include <vector> + class tcSimState; + namespace Sensor { *************** *** 67,81 **** }; ! class tcSensorMapTrack { enum {MAX_SENSOR_REPORTS = 2, MAX_EMITTERS = 4}; public: tcTrack track; double mfLastUpdateTime; tsEmitterInfo maEmitterInfo[MAX_EMITTERS]; int mnEmitters; tnPoolIndex mnDatabaseID; // database ID of track bool AddReport(const tcSensorReport& report); ! int GetEmitterCount() {return mnEmitters;} const tsEmitterInfo* GetEmitter(int anIdx) { --- 69,105 ---- }; ! /** ! * State info for track stored in alliance sensor map. ! * The targetedRating is used by the AI to avoid inefficient ganging up on track. ! * engageRating controls how much ordance ! */ ! class tcSensorMapTrack ! { enum {MAX_SENSOR_REPORTS = 2, MAX_EMITTERS = 4}; public: tcTrack track; double mfLastUpdateTime; + tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; // most recent data from contributing sensors + int mnContributors; tsEmitterInfo maEmitterInfo[MAX_EMITTERS]; int mnEmitters; tnPoolIndex mnDatabaseID; // database ID of track + float matchupRating; ///< matchup rating for platforms that have targeted this track + float expectedDamage; ///< rating of expected fractional damage of weapons launched at target, 0 - none, 1.0 - totally destroyed + float assessedDamage; ///< fractional damage assessment + std::vector<long> intercepts; ///< vector of platform ids that are intercepting this track + std::vector<long> engaged; ///< vector of weapon ids that are tracking / engaging + + /// called to indicate weapon launched at target + bool AddEngagement(long id); + + /// called to indicate platform intercepting target + bool AddIntercept(long id); bool AddReport(const tcSensorReport& report); ! ! ///< static method to set pointer to tcSimState object ! static void AttachSimState(tcSimState* ss) {simState = ss;} ! int GetEmitterCount() {return mnEmitters;} const tsEmitterInfo* GetEmitter(int anIdx) { *************** *** 83,93 **** return &maEmitterInfo[anIdx]; } - const tcTrack* GetTrack() {return &track;} - bool UpdateEmitter(tsEmitterInfo*& rpEmitterInfo, tnPoolIndex anEmitterID); bool IsNew() {return track.mfTimestamp == 0;} bool UpdateActiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateClassification(UINT16 mnClassification, teAffiliation meAffiliation, tnPoolIndex mnDatabaseID); bool UpdatePassiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateTrack(void); --- 107,132 ---- return &maEmitterInfo[anIdx]; } + /// gets number of weapons engaging this track + unsigned GetEngagedCount() const; + + /// gets number of platforms intercepting this track + unsigned GetInterceptCount() const; + + const tcTrack* GetTrack() {return &track;} bool IsNew() {return track.mfTimestamp == 0;} + + bool UpdateActiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateClassification(UINT16 mnClassification, teAffiliation meAffiliation, tnPoolIndex mnDatabaseID); + bool UpdateEmitter(tsEmitterInfo*& rpEmitterInfo, tnPoolIndex anEmitterID); + + /// removes engagement ids for weapons no longer engaging this track + void UpdateEngagements(); + + /// removes intercept ids for platforms no longer intercepting this track + void UpdateIntercepts(); + bool UpdatePassiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateTrack(void); *************** *** 98,109 **** ~tcSensorMapTrack(); - tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; // most recent data from contributing sensors - int mnContributors; - void RemoveReport(int n); }; ! class tcAllianceSensorMap { enum {MAX_SMTRACKS = 512, MAX_TRACKS = 512}; public: --- 137,149 ---- ~tcSensorMapTrack(); void RemoveReport(int n); + + private: + static tcSimState *simState; }; ! class tcAllianceSensorMap ! { enum {MAX_SMTRACKS = 512, MAX_TRACKS = 512}; public: *************** *** 130,133 **** --- 170,174 ---- tnPoolIndex maTrackToSensorTrack[MAX_TRACKS]; double mfPreviousStatusTime; + double lastEngagementsUpdate; }; *************** *** 167,169 **** }; } ! #endif // !defined(AFX_TCSENSORMAP_H__57EE0C2E_4C78_4B79_87F1_4770F3E989A9__INCLUDED_) --- 208,210 ---- }; } ! #endif // _SENSORMAP_H_ |
From: <ddc...@us...> - 2004-02-15 19:54:51
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8158/include/scriptinterface Modified Files: tcPlatformInterface.h tcSimPythonInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcPlatformInterface.h 2 Feb 2004 01:21:37 -0000 1.14 --- tcPlatformInterface.h 15 Feb 2004 19:47:21 -0000 1.15 *************** *** 87,113 **** // basic nav commands: heading, speed, altitude ! float GetAltitude() {return mpPlatformObj->mcKin.mfAlt_m;} float GetFuel() const; float GetMaxAltitude(); float GetSpeed(); ! float GetMaxSpeed(); float GetHeading(); ! float GetHeadingRad(); float GetTerrainElevation(); bool HasThrottle(); ! void SetAltitude(float alt_m) {mpPlatformObj->mcGS.mfGoalAltitude_m = alt_m;} void SetPitchLimitDeg(float lim_deg); void SetSpeed(float speed_kts) {mpPlatformObj->SetSpeed(speed_kts);} ! void SetSpeedToMax(void); void SetThrottle(float throttleFraction); void SetHeading(float heading_deg) {mpPlatformObj->SetHeading(C_PIOVER180*heading_deg);} void SetHeadingRad(float heading_rad) {mpPlatformObj->SetHeading(heading_rad);} float GetHeadingToDatum(float afLon_rad, float afLat_rad); float GetRangeToDatum(float afLon_rad, float afLat_rad); // platform info std::string GetPlatformName(void); std::string GetPlatformClass(void); bool IsSurface() {return (mpPlatformObj->mnModelType == MTYPE_SURFACE);} bool IsAir() { UINT32 nModelType = mpPlatformObj->mnModelType; --- 87,143 ---- // basic nav commands: heading, speed, altitude ! /// gets platform altitude in meters ! float GetAltitude() {return mpPlatformObj->mcKin.mfAlt_m;} ! /// gets fraction of fuel remaining from 0 - 1 float GetFuel() const; + /// gets max altitude in meters indicated in database entry. float GetMaxAltitude(); + /// gets current platform speed in kts float GetSpeed(); ! /// gets max platform speed indicated in database (only a nominal max for aerodynamic air platforms) ! float GetMaxSpeed(); ! /// gets current heading in degrees float GetHeading(); ! /// gets current heading in radians ! float GetHeadingRad(); ! /// gets height of terrain under platform in meters float GetTerrainElevation(); + /// true if platform has a throttle control (aero air models) bool HasThrottle(); ! /// set goal altitude for platform in meters ! /** ! * For air objects ! * @param alt_m goal altitude of platform in meters ! */ ! void SetAltitude(float alt_m) {mpPlatformObj->mcGS.mfGoalAltitude_m = alt_m;} ! /// sets maximum +/- pitch for air objects in degrees, workaround to slow descent for cv landing void SetPitchLimitDeg(float lim_deg); + /// sets speed of platform void SetSpeed(float speed_kts) {mpPlatformObj->SetSpeed(speed_kts);} ! /// set speed of platform to maximum speed (use SetThrottle for aero air objects) ! void SetSpeedToMax(void); ! /// set throttle for air objects ! /** ! * for air objects, sets throttle ! * @param throttleFraction 0 - 1.1, use 0 - 1 for non afterburning throttle, 1.1 for afterburners ! */ void SetThrottle(float throttleFraction); + /// sets heading in degrees void SetHeading(float heading_deg) {mpPlatformObj->SetHeading(C_PIOVER180*heading_deg);} + /// sets heading in radians void SetHeadingRad(float heading_rad) {mpPlatformObj->SetHeading(heading_rad);} + /// get heading to (lon,lat) datum in degrees float GetHeadingToDatum(float afLon_rad, float afLat_rad); + /// get range to (lon,lat) datum in km float GetRangeToDatum(float afLon_rad, float afLat_rad); // platform info + /// get unit name of platform std::string GetPlatformName(void); + /// get database class name of platform std::string GetPlatformClass(void); + /// returns true if platform is a surface platform bool IsSurface() {return (mpPlatformObj->mnModelType == MTYPE_SURFACE);} + /// returns true if platform is an air platform bool IsAir() { UINT32 nModelType = mpPlatformObj->mnModelType; *************** *** 117,176 **** // script variables UINT32 GetVar(int n) {return mpPlatformObj->mcAI.GetVar(n);} void SetVar(int n, UINT32 val) {mpPlatformObj->mcAI.SetVar(n,val);} // target commands void SetTarget(long anID) {mpPlatformObj->DesignateTarget(anID);} long GetTarget(void) {return mpPlatformObj->mcAI.GetTarget();} float GetRangeToTarget(void); tcTrack GetTargetTrackInfo(void); tcGameObject* GetTargetObj(void); bool GetTargetTrack(tcTrack& track); ! bool IsLauncherEffective(int anLauncher); ///< is launcher effective vs. target float SetHeadingToInterceptTarget(void); // weapon related commands ! tcLauncherInfo GetBestLauncher(void); ///< best launcher for target int GetLauncherCount(void); void SendDatumToLauncher(float afLon_rad, float afLat_rad, int anLauncher); bool HandoffTargetToLauncher(int anLauncher); void Launch(int anLauncher, int quantity); std::string GetLauncherWeaponName(int anLauncher); int GetLauncherQuantity(int anLauncher); bool IsDatumLaunch(int anLauncher) {return mpPlatformObj->mcLauncherState.IsDatumLaunch(anLauncher);} bool GetLauncherInfo(tcLauncherInfo& info, int anLauncher); // order related commands bool HasOrders(void); tcOrder GetCurrentOrder(void); void CompletedOrder(void); void AddOrder(std::string order_text, long data = -1); void AddNavOrder(float afLon_rad, float afLat_rad); void ClearOrders(void); void DeleteOrder(int n); int GetOrderCount(); tcOrder GetOrder(int n); // sensor map and sensor commands tcTrackIterator GetFirstTrack(void); int GetTrackCount(void); tcTrackIterator GetNextTrack(long nPos); int GetSensorCount(); tcSensorInfo GetSensorInfo(int n); void SetSensorState(int n, int state); ! void SetAllSensorState(int anState); ///< 0 - off, 1 - on tcTrack GetClosestTrack(float afMaxRange_km, UINT16 anClassMask, UINT8 anAffiliation); tcTrack GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrack GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrack GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrackList GetTrackList(int anClassMask, float afMaxRange_km, UINT8 anAffiliation); float GetInterceptHeadingToTrack(const tcTrack& track); float GetRangeToTrack(const tcTrack& track); float SetHeadingToInterceptTrack(tcTrack track); tcTrack GetTrackById(long id); // flightport (airstrip, cv flight deck, helo pad) bool HasFlightPort(void); tcFlightPortInterface GetFlightPortInfo(void); --- 147,248 ---- // script variables + /// returns user variable n UINT32 GetVar(int n) {return mpPlatformObj->mcAI.GetVar(n);} + /// sets user variable n void SetVar(int n, UINT32 val) {mpPlatformObj->mcAI.SetVar(n,val);} // target commands + /// set target for platform void SetTarget(long anID) {mpPlatformObj->DesignateTarget(anID);} + /// get platform target, -1 for no target long GetTarget(void) {return mpPlatformObj->mcAI.GetTarget();} + /// get range to target in km float GetRangeToTarget(void); + /// get track info object for target tcTrack GetTargetTrackInfo(void); tcGameObject* GetTargetObj(void); bool GetTargetTrack(tcTrack& track); ! /// returns true if launcher is effective vs. current target ! bool IsLauncherEffective(int anLauncher); ! /// if target is valid, sets heading to intercept target. float SetHeadingToInterceptTarget(void); // weapon related commands ! /// gets launcher info object for best launcher for target ! tcLauncherInfo GetBestLauncher(void); ! /// gets number of launchers available on platform int GetLauncherCount(void); + /// sets datum for launcher void SendDatumToLauncher(float afLon_rad, float afLat_rad, int anLauncher); + /// hands off platform target to launcher bool HandoffTargetToLauncher(int anLauncher); + /// orders launch void Launch(int anLauncher, int quantity); + /// get class name of launcher weapon std::string GetLauncherWeaponName(int anLauncher); + /// get quantity available for launch in launcher int GetLauncherQuantity(int anLauncher); + /// true if launcher can launch using datum only (i.e. no track just a set of coordinates) bool IsDatumLaunch(int anLauncher) {return mpPlatformObj->mcLauncherState.IsDatumLaunch(anLauncher);} bool GetLauncherInfo(tcLauncherInfo& info, int anLauncher); // order related commands + /// true if platform has any orders bool HasOrders(void); + /// gets order info object for current platform order tcOrder GetCurrentOrder(void); + /// called to indicate current order is complete and to move to next order void CompletedOrder(void); + /// adds generic order void AddOrder(std::string order_text, long data = -1); + /// adds navigation order void AddNavOrder(float afLon_rad, float afLat_rad); + /// clear all orders void ClearOrders(void); + /// delete order void DeleteOrder(int n); + /// get total number of orders int GetOrderCount(); + /// get order info object for order n tcOrder GetOrder(int n); // sensor map and sensor commands + /// get first track in alliance sensor map, track iterator object is returned tcTrackIterator GetFirstTrack(void); + /// gets total number of tracks in alliance sensor map int GetTrackCount(void); + /// gets next track in sensor map, nPos is obtained from track iterator from last call tcTrackIterator GetNextTrack(long nPos); + /// gets number of sensors on platform int GetSensorCount(); + /// gets sensor info object for sensor n tcSensorInfo GetSensorInfo(int n); + /// sets state of sensor n, 0 - off, 1 - on void SetSensorState(int n, int state); ! /// sets state of all sensors on platform, 0 - off, 1 - on ! void SetAllSensorState(int anState); ! /// gets track info object for closest track within range that matches classification and affiliation parameters tcTrack GetClosestTrack(float afMaxRange_km, UINT16 anClassMask, UINT8 anAffiliation); + /// gets track info object for closest air track within range matching affiliation tcTrack GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track info object for closest surface track within range matching affiliation tcTrack GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track info object for closest missile track within range matching affiliation tcTrack GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track list object that has all tracks within range matching affiliation tcTrackList GetTrackList(int anClassMask, float afMaxRange_km, UINT8 anAffiliation); + /// get intercept heading to track in radians float GetInterceptHeadingToTrack(const tcTrack& track); + // get range to track in km float GetRangeToTrack(const tcTrack& track); + /// set heading to intercept track float SetHeadingToInterceptTrack(tcTrack track); + /// get track info object corresponding to track id tcTrack GetTrackById(long id); // flightport (airstrip, cv flight deck, helo pad) + /// true if platform has a flight port (e.g. carrier) bool HasFlightPort(void); tcFlightPortInterface GetFlightPortInfo(void); *************** *** 181,188 **** --- 253,265 ---- void GetUserInput(std::string callback, std::string uitype); void SendCommand(std::string command); + /// display text message in user console void DisplayMessage(std::string text); + /// play sound effect void PlaySound(int n); + /// sets text displayed in platform info panel void SetActionText(std::string text) {mpPlatformObj->mcAI.mzActionText = text;} + /// sets update interval for AI script revisits void SetUpdateInterval(float afInterval) {mpPlatformObj->mcAI.mfUpdateInterval = (afInterval >= 0.25) ? afInterval : 0.25f;} + /// returns a random number between 0 and 1 float GetRand() {return randf();} static void SetObj(tcPlatformObject *apObj) {mpStaticPlatformObj = apObj;} Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcSimPythonInterface.h 29 Jan 2004 00:05:05 -0000 1.9 --- tcSimPythonInterface.h 15 Feb 2004 19:47:21 -0000 1.10 *************** *** 44,48 **** namespace ScriptInterface { ! class tcMenuInterface { public: void AddItem(std::string caption, std::string command); --- 44,52 ---- namespace ScriptInterface { ! /** ! * Interface class for creating popup mouse menus. ! */ ! class tcMenuInterface ! { public: void AddItem(std::string caption, std::string command); |
From: <ddc...@us...> - 2004-02-15 19:54:51
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8158/scripts Modified Files: UnitCommands.py Log Message: Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UnitCommands.py 3 Jan 2004 00:45:12 -0000 1.5 --- UnitCommands.py 15 Feb 2004 19:47:22 -0000 1.6 *************** *** 46,49 **** --- 46,50 ---- lat = track_info.Lat lon = track_info.Lon + UI.HandoffTargetToLauncher(launcher) # so that intended target is set UI.SendDatumToLauncher(lon,lat,launcher) UI.Launch(launcher,1) |
From: <ddc...@us...> - 2004-02-15 19:54:51
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8158 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** GCblue.vcproj 12 Feb 2004 01:54:48 -0000 1.37 --- GCblue.vcproj 15 Feb 2004 19:47:21 -0000 1.38 *************** *** 404,407 **** --- 404,410 ---- RelativePath="src\sim\tcUserInfo.cpp"> </File> + <File + RelativePath="src\sim\tcWeaponObject.cpp"> + </File> </Filter> <Filter *************** *** 726,729 **** --- 729,735 ---- </File> <File + RelativePath="include\sim\tcWeaponObject.h"> + </File> + <File RelativePath="include\sim\tsSensorState.h"> </File> |
From: <ddc...@us...> - 2004-02-13 01:36:55
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv386/src/sim Modified Files: Game.cpp tcAeroAirObject.cpp tcAirObject.cpp tcCarrierObject.cpp tcESMSensor.cpp tcMissileObject.cpp tcObjectControl.cpp tcPlatformObject.cpp tcRadar.cpp tcSensorMap.cpp tcSensorState.cpp tcSimState.cpp tcSurfaceObject.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Game.cpp 5 Feb 2004 23:17:05 -0000 1.57 --- Game.cpp 13 Feb 2004 01:31:33 -0000 1.58 *************** *** 132,139 **** mnLeftMargin = 200; mnBottomMargin = 200; } /** ! * The tcGame object constructor. * */ --- 132,141 ---- mnLeftMargin = 200; mnBottomMargin = 200; + + std::cout << "Game constructor success" << std::endl; } /** ! * The tcGame object destructor. * */ *************** *** 323,331 **** --- 325,337 ---- startTime = wxDateTime::Now(); + std::cout << "Time init success" << std::endl; + try { StartMusic(); + std::cout << "Music start success" << std::endl; Initialize3DViewer(); + std::cout << "3D viewer init success" << std::endl; /* ** Init graphics engine * **/ *************** *** 392,395 **** --- 398,402 ---- throw; } + std::cout << "Game init success" << std::endl << std::endl; } Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcAeroAirObject.cpp 29 Jan 2004 00:05:38 -0000 1.4 --- tcAeroAirObject.cpp 13 Feb 2004 01:31:33 -0000 1.5 *************** *** 104,108 **** } ! void tcAeroAirObject::UpdateKin(double afStatusTime) { const float min_update_s = 0.0f; --- 104,108 ---- } ! void tcAeroAirObject::Update(double afStatusTime) { const float min_update_s = 0.0f; *************** *** 129,132 **** --- 129,134 ---- UpdateLauncherState(dt_s); + UpdateSensors(afStatusTime); + mfStatusTime = afStatusTime; } Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcAirObject.cpp 29 Jan 2004 00:05:38 -0000 1.6 --- tcAirObject.cpp 13 Feb 2004 01:31:33 -0000 1.7 *************** *** 224,228 **** } ! void tcAirObject::UpdateKin(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); --- 224,228 ---- } ! void tcAirObject::Update(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 247,250 **** --- 247,252 ---- UpdateLauncherState(dt_s); + UpdateSensors(afStatusTime); + mfStatusTime = afStatusTime; } Index: tcCarrierObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCarrierObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcCarrierObject.cpp 5 Jan 2004 02:48:03 -0000 1.6 --- tcCarrierObject.cpp 13 Feb 2004 01:31:33 -0000 1.7 *************** *** 180,186 **** } /******************************************************************************/ ! void tcCarrierObject::UpdateKin(double afStatusTime) { ! tcSurfaceObject::UpdateKin(afStatusTime); flight_deck.Update(afStatusTime); UpdateLaunch(); --- 180,186 ---- } /******************************************************************************/ ! void tcCarrierObject::Update(double afStatusTime) { ! tcSurfaceObject::Update(afStatusTime); flight_deck.Update(afStatusTime); UpdateLaunch(); Index: tcESMSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcESMSensor.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcESMSensor.cpp 12 Feb 2004 01:54:49 -0000 1.2 --- tcESMSensor.cpp 13 Feb 2004 01:31:33 -0000 1.3 *************** *** 52,56 **** if (emitter == NULL) {return false;} ! if ((!emitter->mbActive)||(emitter->IsSemiactive())) {return false;} const tcKinematics& emitter_kin = emitter->parent->mcKin; --- 52,56 ---- if (emitter == NULL) {return false;} ! if ((!emitter->GetActive())||(emitter->IsSemiactive())) {return false;} const tcKinematics& emitter_kin = emitter->parent->mcKin; Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcMissileObject.cpp 7 Feb 2004 02:19:54 -0000 1.6 --- tcMissileObject.cpp 13 Feb 2004 01:31:33 -0000 1.7 *************** *** 23,27 **** * */ ! void tcMissileObject::UpdateKin(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); --- 23,27 ---- * */ ! void tcMissileObject::Update(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 79,82 **** --- 79,84 ---- } + mcSensorState.Update(afStatusTime); + mfStatusTime = afStatusTime; *************** *** 119,125 **** break; case GM_SENSOR1: ! if (!mcSensorState.mbActive) { ! mcSensorState.mbActive = true; mcSensorState.mnMode = SSMODE_SEEKERSEARCH; mfGuidanceUpdateInterval = 0.5f; --- 121,127 ---- break; case GM_SENSOR1: ! if (!mcSensorState.GetActive()) { ! mcSensorState.SetActive(true); mcSensorState.mnMode = SSMODE_SEEKERSEARCH; mfGuidanceUpdateInterval = 0.5f; *************** *** 242,247 **** void tcMissileObject::DesignateTarget(long anID) { ! mcSensorState.mcTrack.mnID=anID; ! mcSensorState.mnMode=SSMODE_SEEKERACQUIRE; } --- 244,249 ---- void tcMissileObject::DesignateTarget(long anID) { ! mcSensorState.mcTrack.mnID = anID; ! mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; } Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcObjectControl.cpp 2 Feb 2004 01:21:37 -0000 1.12 --- tcObjectControl.cpp 13 Feb 2004 01:31:33 -0000 1.13 *************** *** 791,795 **** { tcSensorState *pSensorState = pSS->at(i); ! bool bActive = pSensorState->mbActive ? true : false; teButtonState eSensorState = bActive ? BS_ACTIVE : BS_DISABLED; mcSensorPanel.SetCaption(pSensorState->mpDBObj->mzClass.mz, i, 0); --- 791,795 ---- { tcSensorState *pSensorState = pSS->at(i); ! bool bActive = pSensorState->GetActive() ? true : false; teButtonState eSensorState = bActive ? BS_ACTIVE : BS_DISABLED; mcSensorPanel.SetCaption(pSensorState->mpDBObj->mzClass.mz, i, 0); *************** *** 1297,1301 **** { tcSensorState *pSensorState = pSS->at(anSensor); ! pSensorState->mbActive = !pSensorState->mbActive; return true; } --- 1297,1301 ---- { tcSensorState *pSensorState = pSS->at(anSensor); ! pSensorState->SetActive(!pSensorState->GetActive()); return true; } *************** *** 1492,1496 **** tcSensorState *pSensorState = pSS->at(i); tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorState); ! bool bActive = pSensorState->mbActive ? true : false; if ((pRadarSS)&&(bActive)) { --- 1492,1496 ---- tcSensorState *pSensorState = pSS->at(i); tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorState); ! bool bActive = pSensorState->GetActive() ? true : false; if ((pRadarSS)&&(bActive)) { Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcPlatformObject.cpp 12 Feb 2004 21:41:53 -0000 1.16 --- tcPlatformObject.cpp 13 Feb 2004 01:31:33 -0000 1.17 *************** *** 220,224 **** } ! void tcPlatformObject::UpdateKin(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); --- 220,224 ---- } ! void tcPlatformObject::Update(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 255,259 **** for (int k=0;k<nSensors;k++) { tcSensorState *pSensorState = mapSensorState[k]; ! if (pSensorState->mbActive) {return true;} } return false; --- 255,259 ---- for (int k=0;k<nSensors;k++) { tcSensorState *pSensorState = mapSensorState[k]; ! if (pSensorState->GetActive()) {return true;} } return false; *************** *** 266,270 **** tcSensorState *pSensorState = mapSensorState[k]; if (dynamic_cast<tcRadar*>(pSensorState)) { ! if (pSensorState->mbActive) {return true;} } } --- 266,270 ---- tcSensorState *pSensorState = mapSensorState[k]; if (dynamic_cast<tcRadar*>(pSensorState)) { ! if (pSensorState->GetActive()) {return true;} } } Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcRadar.cpp 12 Feb 2004 21:41:53 -0000 1.3 --- tcRadar.cpp 13 Feb 2004 01:31:33 -0000 1.4 *************** *** 1,20 **** /* ! * 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 "aerror.h" --- 1,20 ---- /* ! * 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 "aerror.h" *************** *** 33,38 **** /** ! * ! */ bool tcRadar::InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad) { --- 33,38 ---- /** ! * ! */ bool tcRadar::InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad) { *************** *** 58,63 **** /** ! * ! */ bool tcRadar::CanDetectTarget(const tcGameObject* target, float& range_km) { --- 58,63 ---- /** ! * ! */ bool tcRadar::CanDetectTarget(const tcGameObject* target, float& range_km) { *************** *** 130,136 **** return false; } ! bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || ! (mpDBObj->mbDetectsSurface && isSurface); bool bDetectable; --- 130,136 ---- return false; } ! bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || ! (mpDBObj->mbDetectsSurface && isSurface); bool bDetectable; *************** *** 139,145 **** bDetectable = 20.0f*(2.0f*log10f(mpDBObj->mfRefRange_km) ! - log10f(fTargetRange_km) ! - log10f(illuminatorTargetRange_km) ! ) + rcs_dBsm >= 0; } else --- 139,145 ---- bDetectable = 20.0f*(2.0f*log10f(mpDBObj->mfRefRange_km) ! - log10f(fTargetRange_km) ! - log10f(illuminatorTargetRange_km) ! ) + rcs_dBsm >= 0; } else *************** *** 149,153 **** } return bDetectable && bTargetTypeMatch; ! } --- 149,153 ---- } return bDetectable && bTargetTypeMatch; ! } *************** *** 168,173 **** /** ! * ! */ void tcRadar::Serialize(tcFile& file, bool mbLoad) { --- 168,173 ---- /** ! * ! */ void tcRadar::Serialize(tcFile& file, bool mbLoad) { *************** *** 183,187 **** { wxASSERT(isSemiactive || isCommandReceiver); ! illuminatorID = illum_id; illuminatorSensorIdx = sensor_idx; --- 183,187 ---- { wxASSERT(isSemiactive || isCommandReceiver); ! illuminatorID = illum_id; illuminatorSensorIdx = sensor_idx; *************** *** 189,194 **** /** ! * ! */ tcRadar& tcRadar::operator=(tcRadar& ss) { --- 189,194 ---- /** ! * ! */ tcRadar& tcRadar::operator=(tcRadar& ss) { *************** *** 200,205 **** /** ! * ! */ tcRadar* tcRadar::Clone(void) { --- 200,205 ---- /** ! * ! */ tcRadar* tcRadar::Clone(void) { *************** *** 254,257 **** --- 254,340 ---- /** + * Updates missile seeker radar. + */ + void tcRadar::UpdateSeeker(double t) + { + long nTargetID; + tcGameObject *ptarget; + int bFound; + + + switch (mnMode) + { + case SSMODE_SEEKERACQUIRE: // fall through to SEEKERTRACK + case SSMODE_SEEKERTRACK: + nTargetID = mcTrack.mnID; + if (nTargetID == parent->mnID) // no self detection + { + bFound = false; + } + else + { + bFound = simState->maPlatformState.Lookup(nTargetID,ptarget); + } + if (bFound) + { // own-alliance is allowed + float fRange_km; + if (CanDetectTarget(ptarget, fRange_km)) + { + UpdateTrack(ptarget, t); + return; + } + } + // shut down missile if track lost for > 7 seconds + if ((mnMode == SSMODE_SEEKERTRACK)&& + (t - mcTrack.mfTimestamp) > 7.0) + { + parent->mfDamageLevel = 1.0f; + mcTrack.mnID = NULL_INDEX; + if(simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) + { + char zBuff[128]; + sprintf(zBuff,"Missile %d shut down\n", parent->mnID); + simState->mpCommandInterface->DisplayInfoMessage(zBuff); + } + return; + } + // this code to enter search mode after track lost + //pTrack->mnID = NULL_INDEX; + //apRadarSS->mnMode = SSMODE_SEEKERSEARCH; + break; + case SSMODE_SEEKERSEARCH: + { + // get list of candidate tracks/detections + tcGeoRect region; + GetTestArea(region); + + tcGameObjIterator iter(region); + float minRange = 1e15f; + tnPoolIndex minID = NULL_INDEX; + + // find closest detectable target + for (iter.First();iter.NotDone();iter.Next()) + { + tcGameObject *target = iter.Get(); + if (target != parent) // no self detection + { + float range_km; + bool bDetected = (parent->mnAlliance != target->mnAlliance) && + CanDetectTarget(target,range_km); + if ((bDetected) && (range_km < minRange)) + { + minID = target->mnID; + minRange = range_km; + } + } + } + + if (minID==NULL_INDEX) return; // no targets found + parent->DesignateTarget(minID); // select closest as target + } + } + } + + /** * Called after a surveillance detection to update sensor map for * appropriate alliance. *************** *** 325,329 **** float range_km; bool bDetected = (parent->mnAlliance != target->mnAlliance) && ! CanDetectTarget(target,range_km); if (bDetected) UpdateSensorMap(t, target, range_km); --- 408,412 ---- float range_km; bool bDetected = (parent->mnAlliance != target->mnAlliance) && ! CanDetectTarget(target,range_km); if (bDetected) UpdateSensorMap(t, target, range_km); *************** *** 332,351 **** } ! void tcRadar::Update(double t) { ! if ((mnMode != SSMODE_SURVEILLANCE) && (mnMode != SSMODE_FCSURVEILLANCE)) { ! return; } if (!UpdateScan(t)) return; // only update once per scan period wxASSERT(parent); ! ! UpdateSurveillance(t); } /** ! * ! */ tcRadar::tcRadar() : tcSensorState() --- 415,464 ---- } ! /** ! * Update sensor track with target state. Normally used with ! * missile seekers. ! */ ! void tcRadar::UpdateTrack(const tcGameObject* target, double t) { ! ! mcTrack.mfLat_rad = (float)target->mcKin.mfLat_rad; ! mcTrack.mfLon_rad = (float)target->mcKin.mfLon_rad; ! mcTrack.mfAlt_m = target->mcKin.mfAlt_m; ! mcTrack.mfSpeed_kts = target->mcKin.mfSpeed_kts; ! mcTrack.mfHeading_rad = target->mcKin.mfHeading_rad; ! mcTrack.mfClimbAngle_rad = target->mcKin.mfClimbAngle_rad; ! mcTrack.mfTimestamp = t; ! mcTrack.mnFlags = (TRACK_HEADING_VALID | TRACK_SPEED_VALID ! | TRACK_ALT_VALID | TRACK_CLIMB_VALID); ! if (mnMode == SSMODE_SEEKERACQUIRE) { ! mnMode = SSMODE_SEEKERTRACK; ! if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) ! { ! simState->mpSound->PlayEffect(SEFFECT_TWOBEEPS); ! } } + } + void tcRadar::Update(double t) + { if (!UpdateScan(t)) return; // only update once per scan period wxASSERT(parent); ! ! if ((mnMode == SSMODE_SURVEILLANCE) || (mnMode == SSMODE_FCSURVEILLANCE)) ! { ! UpdateSurveillance(t); ! } ! else if ((mnMode == SSMODE_SEEKERTRACK)||(mnMode == SSMODE_SEEKERSEARCH) ! ||(mnMode == SSMODE_SEEKERACQUIRE)) ! { ! UpdateSeeker(t); ! } ! } /** ! * ! */ tcRadar::tcRadar() : tcSensorState() *************** *** 365,370 **** /** ! * ! */ tcRadar::~tcRadar() { --- 478,483 ---- /** ! * ! */ tcRadar::~tcRadar() { Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSensorMap.cpp 7 Feb 2004 02:19:54 -0000 1.4 --- tcSensorMap.cpp 13 Feb 2004 01:31:33 -0000 1.5 *************** *** 358,362 **** } ! void tcAllianceSensorMap::Update(double afStatusTime) { tnPoolIndex cmappos = maTrack.GetStartPosition(); tnPoolIndex nSize = maTrack.GetCount(); --- 358,367 ---- } ! void tcAllianceSensorMap::Update(double afStatusTime) ! { ! #ifdef _DEBUG ! wxASSERT(maTrack.CheckForCorruption()==false); ! #endif ! tnPoolIndex cmappos = maTrack.GetStartPosition(); tnPoolIndex nSize = maTrack.GetCount(); *************** *** 367,381 **** mfPreviousStatusTime = afStatusTime; ! for (tnPoolIndex i=0;i<nSize;i++) { maTrack.GetNextAssoc(cmappos,nKey,psmtrack); bool bAgedReport = false; ! for(int n=0;(n<psmtrack->mnContributors)&&(!bAgedReport);n++) { ! if (afStatusTime - psmtrack->maSensorReport[n].mfTimestamp > SENSORMAP_AGEOUTTIME) { psmtrack->RemoveReport(n); bAgedReport = true; } } ! if (psmtrack->mnContributors == 0) { ! if (psmtrack->track.mnID >= 0) { maTrackToSensorTrack[psmtrack->track.mnID] = NULL_INDEX; // used to be = maTrack.GetPoolSize(); } --- 372,391 ---- mfPreviousStatusTime = afStatusTime; ! for (tnPoolIndex i=0;i<nSize;i++) ! { maTrack.GetNextAssoc(cmappos,nKey,psmtrack); bool bAgedReport = false; ! for(int n=0;(n<psmtrack->mnContributors)&&(!bAgedReport);n++) ! { ! if (afStatusTime - psmtrack->maSensorReport[n].mfTimestamp > SENSORMAP_AGEOUTTIME) ! { psmtrack->RemoveReport(n); bAgedReport = true; } } ! if (psmtrack->mnContributors <= 0) ! { ! if (psmtrack->track.mnID >= 0) ! { maTrackToSensorTrack[psmtrack->track.mnID] = NULL_INDEX; // used to be = maTrack.GetPoolSize(); } *************** *** 383,390 **** sprintf(zBuff,"Dropped track %d at time %.1f",psmtrack->track.mnID,afStatusTime); WTL(zBuff); maTrack.RemoveKey(nKey); } ! else { // check for new data and update psmtrack->UpdateTrack(); --- 393,407 ---- sprintf(zBuff,"Dropped track %d at time %.1f",psmtrack->track.mnID,afStatusTime); WTL(zBuff); + #ifdef _DEBUG + wxASSERT(maTrack.CheckForCorruption()==false); + #endif maTrack.RemoveKey(nKey); + #ifdef _DEBUG + wxASSERT(maTrack.CheckForCorruption()==false); + #endif } ! else ! { // check for new data and update psmtrack->UpdateTrack(); *************** *** 392,395 **** --- 409,416 ---- } } + + #ifdef _DEBUG + wxASSERT(maTrack.CheckForCorruption()==false); + #endif } *************** *** 539,544 **** } ! void tcSensorMap::Update(double afStatusTime) { ! for(int n=0;n<mnMaps;n++) { mapMap[n]->Update(afStatusTime); } --- 560,567 ---- } ! void tcSensorMap::Update(double afStatusTime) ! { ! for(int n=0;n<mnMaps;n++) ! { mapMap[n]->Update(afStatusTime); } Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSensorState.cpp 12 Feb 2004 01:54:49 -0000 1.6 --- tcSensorState.cpp 13 Feb 2004 01:31:33 -0000 1.7 *************** *** 91,94 **** --- 91,108 ---- } + /** + * Activate or deactivate sensor. If activated mfLastScan is + * set to current time to give one scan delay for new detections + */ + void tcSensorState::SetActive(bool active) + { + if (mbActive == (int)active) return; + if (active) + { + mfLastScan = simState->GetTime(); + } + mbActive = active; + } + void tcSensorState::Update(double t) { Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcSimState.cpp 12 Feb 2004 21:41:53 -0000 1.32 --- tcSimState.cpp 13 Feb 2004 01:31:33 -0000 1.33 *************** *** 141,145 **** return false; } ! mcDefaultRadar.mbActive = true; mcDefaultRadar.SetParent(reference); --- 141,145 ---- return false; } ! mcDefaultRadar.SetActive(true); mcDefaultRadar.SetParent(reference); *************** *** 263,267 **** for (int i=0;i<nSize;i++) { maPlatformState.GetNextAssoc(cmappos,nKey,pplat); ! pplat->UpdateKin(mfSimTime); { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat); --- 263,267 ---- for (int i=0;i<nSize;i++) { maPlatformState.GetNextAssoc(cmappos,nKey,pplat); ! pplat->Update(mfSimTime); { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat); *************** *** 288,291 **** --- 288,295 ---- UpdateAI(mfSimTime); goalTracker->Update(mfSimTime); + + #ifdef _DEBUG + wxASSERT(maPlatformState.CheckForCorruption()==false); + #endif } /********************************************************************/ *************** *** 1194,1198 **** { pMissileObj->msWaypoint = pLauncher->msDatum; ! pMissileObj->mcSensorState.mbActive = true; pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; --- 1198,1202 ---- { pMissileObj->msWaypoint = pLauncher->msDatum; ! pMissileObj->mcSensorState.SetActive(true); pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; *************** *** 1595,1599 **** else if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(pplat)) { pSensorState = pMissileObj->GetSensorState(); ! bActiveFound = pSensorState->mbActive; } --- 1599,1603 ---- else if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(pplat)) { pSensorState = pMissileObj->GetSensorState(); ! bActiveFound = pSensorState->GetActive(); } Index: tcSurfaceObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcSurfaceObject.cpp 29 Jan 2004 00:05:54 -0000 1.7 --- tcSurfaceObject.cpp 13 Feb 2004 01:31:33 -0000 1.8 *************** *** 70,74 **** } ! void tcSurfaceObject::UpdateKin(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); --- 70,74 ---- } ! void tcSurfaceObject::Update(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 92,95 **** --- 92,97 ---- UpdateLauncherState(dt_s); + UpdateSensors(afStatusTime); + mfStatusTime = afStatusTime; } |
From: <ddc...@us...> - 2004-02-13 01:36:54
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv386/include/sim Modified Files: tcAeroAirObject.h tcAirObject.h tcCarrierObject.h tcGameObject.h tcMissileObject.h tcPlatformObject.h tcPool.h tcRadar.h tcSensorMap.h tcSensorState.h tcSimState.h tcSurfaceObject.h Log Message: Index: tcAeroAirObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAeroAirObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcAeroAirObject.h 9 Dec 2003 00:36:03 -0000 1.2 --- tcAeroAirObject.h 13 Feb 2004 01:31:32 -0000 1.3 *************** *** 53,57 **** virtual void UpdateClimb(float dt_s); virtual void UpdateHeading(float dt_s); ! virtual void UpdateKin(double afStatusTime); virtual void UpdateSpeed(float dt_s); private: --- 53,57 ---- virtual void UpdateClimb(float dt_s); virtual void UpdateHeading(float dt_s); ! virtual void Update(double afStatusTime); virtual void UpdateSpeed(float dt_s); private: Index: tcAirObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAirObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcAirObject.h 8 Dec 2003 03:06:36 -0000 1.5 --- tcAirObject.h 13 Feb 2004 01:31:32 -0000 1.6 *************** *** 39,43 **** void SetPitchLimit(float limit_rad); virtual void UpdateClimb(float dt_s); ! virtual void UpdateKin(double afStatusTime); void PrintToFile(tcFile& file); --- 39,43 ---- void SetPitchLimit(float limit_rad); virtual void UpdateClimb(float dt_s); ! virtual void Update(double afStatusTime); void PrintToFile(tcFile& file); Index: tcCarrierObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCarrierObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcCarrierObject.h 5 Jan 2004 02:48:02 -0000 1.5 --- tcCarrierObject.h 13 Feb 2004 01:31:32 -0000 1.6 *************** *** 43,47 **** virtual void Serialize(tcFile& file, bool mbLoad); void SetFlightportDefaults(); ! virtual void UpdateKin(double afStatusTime); virtual void UpdateLaunch(); --- 43,47 ---- virtual void Serialize(tcFile& file, bool mbLoad); void SetFlightportDefaults(); ! virtual void Update(double afStatusTime); virtual void UpdateLaunch(); Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcGameObject.h 1 Feb 2004 22:19:08 -0000 1.12 --- tcGameObject.h 13 Feb 2004 01:31:32 -0000 1.13 *************** *** 103,107 **** virtual void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); ! virtual void UpdateKin(double afStatusTime) {} virtual void UpdateCaptivePosition(void); --- 103,107 ---- virtual void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); ! virtual void Update(double afStatusTime) {} virtual void UpdateCaptivePosition(void); Index: tcMissileObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMissileObject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcMissileObject.h 7 Feb 2004 02:19:54 -0000 1.4 --- tcMissileObject.h 13 Feb 2004 01:31:32 -0000 1.5 *************** *** 53,57 **** void Clear(void); void RandInitNear(float afLon_deg, float afLat_deg); ! virtual void UpdateKin(double afStatusTime); virtual void UpdateGuidance(double afStatusTime); virtual void SetHeading(float afNewHeading) {mfGoalHeading_rad=afNewHeading;} --- 53,57 ---- void Clear(void); void RandInitNear(float afLon_deg, float afLat_deg); ! virtual void Update(double afStatusTime); virtual void UpdateGuidance(double afStatusTime); virtual void SetHeading(float afNewHeading) {mfGoalHeading_rad=afNewHeading;} Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcPlatformObject.h 12 Feb 2004 21:41:52 -0000 1.11 --- tcPlatformObject.h 13 Feb 2004 01:31:32 -0000 1.12 *************** *** 75,79 **** virtual int SetLaunch(int anLauncher, int anQuantity); virtual void SetFormation(tsFormationParameters asFP) {msFormationParameters=asFP;} ! virtual void UpdateKin(double afStatusTime); void PrintToFile(tcFile&); --- 75,79 ---- virtual int SetLaunch(int anLauncher, int anQuantity); virtual void SetFormation(tsFormationParameters asFP) {msFormationParameters=asFP;} ! virtual void Update(double afStatusTime); void PrintToFile(tcFile&); Index: tcPool.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPool.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcPool.h 12 Feb 2004 01:54:49 -0000 1.4 --- tcPool.h 13 Feb 2004 01:31:32 -0000 1.5 *************** *** 38,41 **** --- 38,42 ---- tnPoolIndex GetPrevKey(tnPoolIndex pos); T operator[] (tnPoolIndex index) const; // r-value version + bool CheckForCorruption(); //T*& operator[] (tnPoolIndex index); // l-value version, T has to support assignment bool CreateAndAddElement(T*& pt, tnPoolIndex& newkey); // T object created with new *************** *** 62,65 **** --- 63,82 ---- /***** inline function definitions *****/ /**********************************************************/ + + + template <class T, int POOLSIZE> + bool tcPool<T,POOLSIZE>::CheckForCorruption() + { + if (mpool[POOLSIZE-1] != NULL) + { + return true; + } + else + { + return false; + } + } + + template <class T, int POOLSIZE> bool tcPool<T,POOLSIZE>::Lookup(tnPoolIndex n,T*& pt) { *************** *** 131,134 **** --- 148,152 ---- maPrev[newkey] = NULL_INDEX; } + fprintf(stdout,"added element %d\n",newkey); return true; } *************** *** 292,299 **** mnTail = maPrev[n]; // if n is tail then n prev becomes new tail } ! if (maPrev[n] < POOLSIZE) { maNext[maPrev[n]] = maNext[n]; // maNext[n] can be invalid } ! if (maNext[n] < POOLSIZE) { maPrev[maNext[n]] = maPrev[n]; // maPrev[n] can be invalid } --- 310,319 ---- mnTail = maPrev[n]; // if n is tail then n prev becomes new tail } ! if ((maPrev[n] >= 0)&&(maPrev[n] < POOLSIZE)) ! { maNext[maPrev[n]] = maNext[n]; // maNext[n] can be invalid } ! if ((maNext[n] >=0 )&&(maNext[n] < POOLSIZE)) ! { maPrev[maNext[n]] = maPrev[n]; // maPrev[n] can be invalid } *************** *** 334,341 **** mnTail = maPrev[n]; // if n is tail then n prev becomes new tail } ! if (maPrev[n] < POOLSIZE) { maNext[maPrev[n]] = maNext[n]; // maNext[n] can be invalid } ! if (maNext[n] < POOLSIZE) { maPrev[maNext[n]] = maPrev[n]; // maPrev[n] can be invalid } --- 354,363 ---- mnTail = maPrev[n]; // if n is tail then n prev becomes new tail } ! if ((maPrev[n] >= 0)&&(maPrev[n] < POOLSIZE)) ! { maNext[maPrev[n]] = maNext[n]; // maNext[n] can be invalid } ! if ((maNext[n] >= 0)&&(maNext[n] < POOLSIZE)) ! { maPrev[maNext[n]] = maPrev[n]; // maPrev[n] can be invalid } Index: tcRadar.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadar.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcRadar.h 12 Feb 2004 21:41:52 -0000 1.3 --- tcRadar.h 13 Feb 2004 01:31:32 -0000 1.4 *************** *** 87,92 **** --- 87,94 ---- tcRadar* GetSemiactiveIlluminator(); + void UpdateSeeker(double t); void UpdateSensorMap(double t, const tcGameObject* target, float range_km); void UpdateSurveillance(double t); + void UpdateTrack(const tcGameObject* target, double t); }; Index: tcSensorMap.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorMap.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcSensorMap.h 19 Oct 2003 17:46:01 -0000 1.2 --- tcSensorMap.h 13 Feb 2004 01:31:32 -0000 1.3 *************** *** 53,58 **** mfTimestamp=0;mfStartTime=0; mfStartTime = 0; ! mnTrackID=0; ! mnSensorPlatformID=0; mnFlags=0; mbClassified = 0; --- 53,58 ---- mfTimestamp=0;mfStartTime=0; mfStartTime = 0; ! mnTrackID = -1; ! mnSensorPlatformID = -1; mnFlags=0; mbClassified = 0; Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcSensorState.h 12 Feb 2004 01:54:49 -0000 1.7 --- tcSensorState.h 13 Feb 2004 01:31:32 -0000 1.8 *************** *** 31,37 **** #define SSMODE_SURVEILLANCE 1 ! #define SSMODE_SEEKERTRACK 2 ! #define SSMODE_SEEKERSEARCH 3 ! #define SSMODE_SEEKERACQUIRE 4 #define SSMODE_FC 5 // fire control only #define SSMODE_FCSURVEILLANCE 6 // both --- 31,37 ---- #define SSMODE_SURVEILLANCE 1 ! #define SSMODE_SEEKERTRACK 2 ///< seeker is tracking target ! #define SSMODE_SEEKERSEARCH 3 ///< seeker searching for target ! #define SSMODE_SEEKERACQUIRE 4 ///< seeker has target cue and attempting to track #define SSMODE_FC 5 // fire control only #define SSMODE_FCSURVEILLANCE 6 // both *************** *** 46,51 **** { public: - tcGameObject *parent; int mbActive; tnPoolIndex mnDBKey; tcSensorDBObject *mpDBObj; --- 46,51 ---- { public: int mbActive; + tcGameObject *parent; tnPoolIndex mnDBKey; tcSensorDBObject *mpDBObj; *************** *** 60,66 **** --- 60,68 ---- static void AttachSimState(tcSimState *ss) {simState = ss;} + bool GetActive() const {return mbActive != 0;} void GetTestArea(tcRect& region); virtual bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); void Serialize(tcFile& file, bool mbLoad); + virtual void SetActive(bool active); void SetMountAz(float az) {mountAz_rad = az;} void SetParent(tcGameObject *obj) {parent = obj;} Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcSimState.h 12 Feb 2004 21:41:52 -0000 1.16 --- tcSimState.h 13 Feb 2004 01:31:32 -0000 1.17 *************** *** 80,83 **** --- 80,84 ---- tcUserInfo *mpUserInfo; tcGoalTracker *goalTracker; ///< tracks win/lose victory conditions for each alliance + tcCommandQueue *mpCommandInterface; tcSimPythonInterface *mpPythonInterface; tcSensorMap mcSensorMap; *************** *** 169,173 **** private: tcMapData *mpMapData; - tcCommandQueue *mpCommandInterface; double mfSimTime; DateZulu dateZulu; --- 170,173 ---- Index: tcSurfaceObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSurfaceObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSurfaceObject.h 29 Jan 2004 00:05:21 -0000 1.5 --- tcSurfaceObject.h 13 Feb 2004 01:31:32 -0000 1.6 *************** *** 42,46 **** virtual void Clear(void); virtual void RandInitNear(float afLon_deg, float afLat_deg); ! virtual void UpdateKin(double afStatusTime); virtual void UpdateHeading(float dt_s); --- 42,46 ---- virtual void Clear(void); virtual void RandInitNear(float afLon_deg, float afLat_deg); ! virtual void Update(double afStatusTime); virtual void UpdateHeading(float dt_s); |
From: <ddc...@us...> - 2004-02-13 01:36:54
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv386/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.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcPlatformInterface.cpp 7 Feb 2004 02:19:54 -0000 1.16 --- tcPlatformInterface.cpp 13 Feb 2004 01:31:33 -0000 1.17 *************** *** 688,692 **** if ((n < 0)||(n >= nSensors)) return info; tcSensorState *sensor_state = pSS->at(n); ! info.isActive = sensor_state->mbActive; if (dynamic_cast<tcRadarDBObject*>(sensor_state->mpDBObj)) info.type = 0; --- 688,692 ---- if ((n < 0)||(n >= nSensors)) return info; tcSensorState *sensor_state = pSS->at(n); ! info.isActive = sensor_state->GetActive(); if (dynamic_cast<tcRadarDBObject*>(sensor_state->mpDBObj)) info.type = 0; *************** *** 709,713 **** for(int n=0;n<nSensors;n++) { tcSensorState *pSensorState = pSS->at(n); ! pSensorState->mbActive = anState; } } --- 709,713 ---- for(int n=0;n<nSensors;n++) { tcSensorState *pSensorState = pSS->at(n); ! pSensorState->SetActive(anState); } } *************** *** 719,723 **** if ((n < 0)||(n >= nSensors)) return; tcSensorState *sensor_state = pSS->at(n); ! sensor_state->mbActive = state; } --- 719,723 ---- if ((n < 0)||(n >= nSensors)) return; tcSensorState *sensor_state = pSS->at(n); ! sensor_state->SetActive(state); } |
From: <ddc...@us...> - 2004-02-13 01:36:54
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv386/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.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcSound.cpp 20 Jan 2004 03:02:53 -0000 1.11 --- tcSound.cpp 13 Feb 2004 01:31:33 -0000 1.12 *************** *** 91,95 **** LoadWavDataFromFile("Beep2.wav",SEFFECT_BEEP2); LoadWavDataFromFile("RejectBeep.wav",SEFFECT_REJECTBEEP); ! LoadWavDataFromFile("LightSaber.wav",SEFFECT_LIGHTSABER); LoadWavDataFromFile("Ping.wav",SEFFECT_PING); LoadWavDataFromFile("Ping2.wav",SEFFECT_PING2); --- 91,95 ---- LoadWavDataFromFile("Beep2.wav",SEFFECT_BEEP2); LoadWavDataFromFile("RejectBeep.wav",SEFFECT_REJECTBEEP); ! LoadWavDataFromFile("Ping.wav",SEFFECT_LIGHTSABER); LoadWavDataFromFile("Ping.wav",SEFFECT_PING); LoadWavDataFromFile("Ping2.wav",SEFFECT_PING2); *************** *** 150,153 **** --- 150,158 ---- alutLoadWAVFile((ALbyte*)zFilePath,&format,&wave,&size,&freq,&loop); + if (wave == NULL) + { + fprintf(stderr,"File not found, wav file %s\n",azFileName); + return false; + } if((err=alGetError())!=AL_NO_ERROR) { *************** *** 158,161 **** --- 163,172 ---- alutUnloadWAV(format,wave,size,freq); + if((err=alGetError())!=AL_NO_ERROR) + { + fprintf(stderr,"Error buffering wav file %s\n",azFileName); + return false; + } + return true; } |
From: <ddc...@us...> - 2004-02-12 21:47:07
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15386/src/sim Modified Files: tcPlatformObject.cpp tcRadar.cpp tcSimState.cpp Log Message: Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcPlatformObject.cpp 7 Feb 2004 02:19:54 -0000 1.15 --- tcPlatformObject.cpp 12 Feb 2004 21:41:53 -0000 1.16 *************** *** 206,209 **** --- 206,222 ---- } + /** + * update platform sensors + */ + void tcPlatformObject::UpdateSensors(double t) + { + unsigned nSensors = mapSensorState.size(); + for(unsigned n=0;n<nSensors;n++) + { + tcSensorState *sensor = mapSensorState[n]; + wxASSERT(sensor); + sensor->Update(t); + } + } void tcPlatformObject::UpdateKin(double afStatusTime) { *************** *** 227,230 **** --- 240,245 ---- UpdateLauncherState(dt_s); + UpdateSensors(afStatusTime); + mfStatusTime = afStatusTime; } Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcRadar.cpp 12 Feb 2004 01:54:49 -0000 1.2 --- tcRadar.cpp 12 Feb 2004 21:41:53 -0000 1.3 *************** *** 28,31 **** --- 28,32 ---- #include "tcMissileDBObject.h" #include "tcSimState.h" + #include "tcGameObjIterator.h" // break up this file later *************** *** 252,290 **** } ! void tcRadar::Update(double t) { ! if (!UpdateScan(t)) return; // only update once per scan period ! wxASSERT(parent); ! tcRect region; GetTestArea(region); ! /* ! tnPoolIndex aTargetKeys[100]; ! tnPoolIndex nTargetID; ! int nCount; ! ! tsGeoPoint currentpos; ! tcGameObject *pTarget; - currentpos.Set((float)applat->mcKin.mfLon_rad,(float)applat->mcKin.mfLat_rad,applat->mcKin.mfAlt_m); - apSensorState->UpdateCoverage(currentpos,applat->mcKin.mfHeading_rad); - apSensorState->GetTestArea(region); - nCount = GetPlatformsWithinRegion(aTargetKeys, 100, ®ion); - bool bOwnAllianceUpdate = mpUserInfo->IsOwnAlliance(applat->mnAlliance); - for(int k=0;k<nCount;k++) { - nTargetID = aTargetKeys[k]; - if (nTargetID != applat->mnID) { // no self detection - pTarget = GetObject(nTargetID); - tcRadar *pRadarSS = dynamic_cast<tcRadar*>(apSensorState); - if (pRadarSS) { - ProcessRadarDetection(applat,pTarget,pRadarSS); - } - else if (tcESMSensor *pESMSS = dynamic_cast<tcESMSensor*>(apSensorState)) { - ProcessESMDetection(applat,pTarget,pESMSS); - } } } ! */ } --- 253,346 ---- } ! /** ! * Called after a surveillance detection to update sensor map for ! * appropriate alliance. ! */ ! void tcRadar::UpdateSensorMap(double t, const tcGameObject* target, float range_km) { ! tcSensorReport *pReport; ! tcSensorMapTrack *pSMTrack; ! bool bAccept = simState->mcSensorMap.UpdateActiveReport(pReport,parent->mnID,target->mnID, ! pSMTrack, parent->mnAlliance); ! if (!bAccept) return; ! ! ! pReport->mfLat_rad = (float)target->mcKin.mfLat_rad; ! pReport->mfLon_rad = (float)target->mcKin.mfLon_rad; ! pReport->mfSpeed_kts = target->mcKin.mfSpeed_kts * cosf(target->mcKin.mfClimbAngle_rad); ! pReport->mfHeading_rad = target->mcKin.mfHeading_rad; ! pReport->mfTimestamp = t; ! pReport->mnSensorPlatformID = parent->mnID; ! pReport->mnTrackID = target->mnID; ! bool bNewReport = pReport->IsNew(); ! bool bNewDetection = pSMTrack->IsNew(); ! if (bNewReport) {pReport->mfStartTime = t;} // new detection ! double fTrackLife = pReport->mfTimestamp - pReport->mfStartTime; ! if (fTrackLife >= 16.0) ! { ! pReport->mnFlags = TRACK_SPEED_VALID | TRACK_HEADING_VALID; ! } ! else ! { ! pReport->mnFlags = 0; ! } ! if ((!pReport->mbClassified)&&(fTrackLife > 10.0)) ! { ! UINT16 nClassification = target->mpDBObject->mnType; ! teAffiliation eAffil = UNKNOWN; ! if (nClassification & PTYPE_MISSILE) {eAffil = HOSTILE;} ! pSMTrack->UpdateClassification(nClassification, eAffil, NULL_INDEX); ! pReport->mbClassified = 1; ! } ! ! ! if (bNewDetection) ! { ! pSMTrack->UpdateTrack(); ! if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) ! { ! simState->mpSound->PlayEffect(SEFFECT_PING); ! } ! char zBuff[128]; ! sprintf(zBuff,"target %d detected at %3.1f km at time %.1f [a:%d]", ! target->mnID,range_km,t,parent->mnAlliance); ! WTLC(zBuff); ! } ! ! } ! ! void tcRadar::UpdateSurveillance(double t) ! { ! tcGeoRect region; GetTestArea(region); ! tcGameObjIterator iter(region); ! ! for (iter.First();iter.NotDone();iter.Next()) ! { ! tcGameObject *target = iter.Get(); ! if (target != parent) // no self detection ! { ! float range_km; ! bool bDetected = (parent->mnAlliance != target->mnAlliance) && ! CanDetectTarget(target,range_km); ! if (bDetected) UpdateSensorMap(t, target, range_km); } } ! } ! ! void tcRadar::Update(double t) ! { ! if ((mnMode != SSMODE_SURVEILLANCE) && (mnMode != SSMODE_FCSURVEILLANCE)) ! { ! return; ! } ! ! if (!UpdateScan(t)) return; // only update once per scan period ! wxASSERT(parent); ! ! UpdateSurveillance(t); } Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcSimState.cpp 12 Feb 2004 01:54:49 -0000 1.31 --- tcSimState.cpp 12 Feb 2004 21:41:53 -0000 1.32 *************** *** 624,628 **** /********************************************************************/ #define MAX_UPDATESENSORS 16 ! void tcSimState::UpdateSensors() { tcGameObject *pplat; tcSensorState *pSensorState; --- 624,630 ---- /********************************************************************/ #define MAX_UPDATESENSORS 16 ! void tcSimState::UpdateSensors() ! { ! /* tcGameObject *pplat; tcSensorState *pSensorState; *************** *** 641,645 **** pSensorState = pSS->at(k); if((pSensorState!=NULL)&&(pSensorState->UpdateScan(mfSimTime))) { ! switch (pSensorState->mnMode) { case SSMODE_FC: case SSMODE_FCSURVEILLANCE: --- 643,648 ---- pSensorState = pSS->at(k); if((pSensorState!=NULL)&&(pSensorState->UpdateScan(mfSimTime))) { ! switch (pSensorState->mnMode) ! { case SSMODE_FC: case SSMODE_FCSURVEILLANCE: *************** *** 680,683 **** --- 683,687 ---- } // for(int i + */ } *************** *** 699,703 **** pSMTrack,apRadarPlat->mnAlliance); ! if (bAccept) { pReport->mfLat_rad = (float)apTarget->mcKin.mfLat_rad; pReport->mfLon_rad = (float)apTarget->mcKin.mfLon_rad; --- 703,708 ---- pSMTrack,apRadarPlat->mnAlliance); ! if (bAccept) ! { pReport->mfLat_rad = (float)apTarget->mcKin.mfLat_rad; pReport->mfLon_rad = (float)apTarget->mcKin.mfLon_rad; *************** *** 711,721 **** if (bNewReport) {pReport->mfStartTime = mfSimTime;} // new detection double fTrackLife = pReport->mfTimestamp - pReport->mfStartTime; ! if (fTrackLife >= 16.0) { pReport->mnFlags = TRACK_SPEED_VALID | TRACK_HEADING_VALID; } ! else { pReport->mnFlags = 0; } ! if ((!pReport->mbClassified)&&(fTrackLife > 10.0)) { tcDatabaseObject *pTargetData; mpDatabase->GetObject(apTarget->mnDBKey,pTargetData); // watch out for bad call here --- 716,729 ---- if (bNewReport) {pReport->mfStartTime = mfSimTime;} // new detection double fTrackLife = pReport->mfTimestamp - pReport->mfStartTime; ! if (fTrackLife >= 16.0) ! { pReport->mnFlags = TRACK_SPEED_VALID | TRACK_HEADING_VALID; } ! else ! { pReport->mnFlags = 0; } ! if ((!pReport->mbClassified)&&(fTrackLife > 10.0)) ! { tcDatabaseObject *pTargetData; mpDatabase->GetObject(apTarget->mnDBKey,pTargetData); // watch out for bad call here *************** *** 728,734 **** ! if (bNewDetection) { pSMTrack->UpdateTrack(); ! if (mpUserInfo->IsOwnAlliance(apRadarPlat->mnAlliance)) {mpSound->PlayEffect(SEFFECT_PING);} char zBuff[128]; sprintf(zBuff,"target %d detected at %3.1f km at time %.1f [a:%d]", --- 736,746 ---- ! if (bNewDetection) ! { pSMTrack->UpdateTrack(); ! if (mpUserInfo->IsOwnAlliance(apRadarPlat->mnAlliance)) ! { ! mpSound->PlayEffect(SEFFECT_PING); ! } char zBuff[128]; sprintf(zBuff,"target %d detected at %3.1f km at time %.1f [a:%d]", *************** *** 856,869 **** } /********************************************************************/ ! void tcSimState::UpdateSurveillance(tcGameObject *applat, tcSensorState *apSensorState) { tnPoolIndex aTargetKeys[100]; tnPoolIndex nTargetID; int nCount; tcRect region; - tsGeoPoint currentpos; tcGameObject *pTarget; - currentpos.Set((float)applat->mcKin.mfLon_rad,(float)applat->mcKin.mfLat_rad,applat->mcKin.mfAlt_m); - //apSensorState->UpdateCoverage(currentpos,applat->mcKin.mfHeading_rad); apSensorState->GetTestArea(region); nCount = GetPlatformsWithinRegion(aTargetKeys, 100, ®ion); --- 868,879 ---- } /********************************************************************/ ! void tcSimState::UpdateSurveillance(tcGameObject *applat, tcSensorState *apSensorState) ! { tnPoolIndex aTargetKeys[100]; tnPoolIndex nTargetID; int nCount; tcRect region; tcGameObject *pTarget; apSensorState->GetTestArea(region); nCount = GetPlatformsWithinRegion(aTargetKeys, 100, ®ion); *************** *** 871,881 **** for(int k=0;k<nCount;k++) { nTargetID = aTargetKeys[k]; ! if (nTargetID != applat->mnID) { // no self detection pTarget = GetObject(nTargetID); tcRadar *pRadarSS = dynamic_cast<tcRadar*>(apSensorState); ! if (pRadarSS) { ProcessRadarDetection(applat,pTarget,pRadarSS); } ! else if (tcESMSensor *pESMSS = dynamic_cast<tcESMSensor*>(apSensorState)) { ProcessESMDetection(applat,pTarget,pESMSS); } --- 881,894 ---- for(int k=0;k<nCount;k++) { nTargetID = aTargetKeys[k]; ! if (nTargetID != applat->mnID) // no self detection ! { pTarget = GetObject(nTargetID); tcRadar *pRadarSS = dynamic_cast<tcRadar*>(apSensorState); ! if (pRadarSS) ! { ProcessRadarDetection(applat,pTarget,pRadarSS); } ! else if (tcESMSensor *pESMSS = dynamic_cast<tcESMSensor*>(apSensorState)) ! { ProcessESMDetection(applat,pTarget,pESMSS); } *************** *** 1387,1390 **** --- 1400,1405 ---- file.Open(sFileName.GetBuffer(),tcFile::modeCreate|tcFile::modeWrite|tcFile::modeText); + sprintf(buff,"Total platform count: %d\n", maPlatformState.GetCount()); + file.WriteString(buff); tcGameObjIterator iter; *************** *** 1400,1403 **** --- 1415,1419 ---- } + file.Close(); } |
From: <ddc...@us...> - 2004-02-12 21:47:06
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15386/include/sim Modified Files: tcPlatformObject.h tcRadar.h tcSimState.h Log Message: Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcPlatformObject.h 2 Feb 2004 01:21:37 -0000 1.10 --- tcPlatformObject.h 12 Feb 2004 21:41:52 -0000 1.11 *************** *** 97,100 **** --- 97,101 ---- virtual void UpdateHeading(float dt_s); virtual void UpdateLauncherState(float dt_s); + virtual void UpdateSensors(double t); virtual void UpdateSpeed(float dt_s); }; \ No newline at end of file Index: tcRadar.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadar.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcRadar.h 12 Feb 2004 01:54:49 -0000 1.2 --- tcRadar.h 12 Feb 2004 21:41:52 -0000 1.3 *************** *** 87,90 **** --- 87,92 ---- tcRadar* GetSemiactiveIlluminator(); + void UpdateSensorMap(double t, const tcGameObject* target, float range_km); + void UpdateSurveillance(double t); }; Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcSimState.h 12 Feb 2004 01:54:49 -0000 1.15 --- tcSimState.h 12 Feb 2004 21:41:52 -0000 1.16 *************** *** 77,80 **** --- 77,81 ---- tcPool<tcGameObject,N_GAME_OBJECTS> maPlatformState; tcDatabase *mpDatabase; // these should be private with better design + tcSound *mpSound; ///< should be converted into a singleton class tcUserInfo *mpUserInfo; tcGoalTracker *goalTracker; ///< tracks win/lose victory conditions for each alliance *************** *** 168,172 **** private: tcMapData *mpMapData; - tcSound *mpSound; tcCommandQueue *mpCommandInterface; double mfSimTime; --- 169,172 ---- |