[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.55,1.56 tcAeroAirObject.cpp,1.3,1.4 tcAirObject.cpp,1.5,1
Status: Alpha
Brought to you by:
ddcforge
From: <ddc...@pr...> - 2004-01-31 02:32:46
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4193/src/sim Modified Files: Game.cpp tcAeroAirObject.cpp tcAirObject.cpp tcCreditView.cpp tcFlightPort.cpp tcLauncherState.cpp tcMapView.cpp tcMissileObject.cpp tcObjectControl.cpp tcPlatformObject.cpp tcRadarSensorState.cpp tcSimState.cpp tcSurfaceObject.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Game.cpp 20 Jan 2004 03:02:53 -0000 1.55 --- Game.cpp 29 Jan 2004 00:05:26 -0000 1.56 *************** *** 74,77 **** --- 74,78 ---- EVT_COMMAND(ID_STARTGAME, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::StartGame) EVT_COMMAND(ID_NEWHOOK, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::NewHook) + EVT_COMMAND(ID_SECONDARYHOOK, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SecondaryHook) EVT_COMMAND(ID_SETBRIEFING, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SetBriefingMode) EVT_COMMAND(ID_SETPAUSE, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SetPauseMode) *************** *** 240,243 **** --- 241,245 ---- { meScreenMode = CREDIT; + mcSound.PlayMusic("tension1"); } *************** *** 256,259 **** --- 258,262 ---- if (meGameMode == GM_START) { + if (meScreenMode == CREDIT) mcSound.PlayMusic("loop1"); meScreenMode = START; } *************** *** 1434,1437 **** --- 1437,1443 ---- tacticalMap->mbBypassPythonCallback = (mm == MENUMODE_PLATFORMEDIT); wxPoint point = event.GetPosition(); + // workaround to keep popup submenus on screen + if (point.x > mnWidth - 250) point.x = mnWidth - 250; + if (point.y > mnHeight - 200) point.y = mnHeight - 200; popupControl->Track(point); } *************** *** 1707,1710 **** --- 1713,1737 ---- } + + /** + * Used for quick mouse-targeting of another platform. + * Map posts this event when right mouse button is + * clicked over another platform. + * Python script is used to do the targeting to allow + * this to be customized. + */ + void tcGame::SecondaryHook(wxCommandEvent& event) + { + long hookID = tacticalMap->GetHookID(); + long nSecondaryHookID = event.m_extraLong; + + if ((hookID == NULL_INDEX) || (hookID == nSecondaryHookID)) + { + return; + } + pythonInterface->ProcessSecondaryHook(nSecondaryHookID); + + } + /* ** deferred methods * **/ #if 0 Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcAeroAirObject.cpp 5 Jan 2004 02:48:03 -0000 1.3 --- tcAeroAirObject.cpp 29 Jan 2004 00:05:38 -0000 1.4 *************** *** 182,187 **** if (throttleFraction <= 1.0f) { ! fThrust_N = mpDBObject->mfMaxThrust_N*throttleFraction; ! fuel_kg -= throttleFraction * mpDBObject->mfFuelRate_kgps * dt_s * damagePenalty; } else --- 182,190 ---- if (throttleFraction <= 1.0f) { ! // apply engine thrust and fuel consumption decrease with altitude ! float adjustedThrottle = throttleFraction * ! expf(- mcKin.mfAlt_m * mpDBObject->mfAltThrustDecay_pm); ! fThrust_N = mpDBObject->mfMaxThrust_N * adjustedThrottle; ! fuel_kg -= adjustedThrottle * mpDBObject->mfFuelRate_kgps * dt_s * damagePenalty; } else *************** *** 237,255 **** float lift_N = weight_N * cosf(k.mfClimbAngle_rad); float Cl = lift_N / (rhv2 * mpDBObject->mfWingArea_sm); ! angleOfAttack = Cl*liftCoeffToAoa; - float inducedDrag_N = mpDBObject->mfKdi * Cl * lift_N; ! if (Cl > 0.9f*mpDBObject->mfMaxCl) { throttleFraction = 1.0f; ! SetAltitude(k.mfAlt_m - 100.0f*(Cl-0.9f*mpDBObject->mfMaxCl)); // max throttle and dive to avoid impending stall ! } ! else if (Cl > mpDBObject->mfMaxCl) { throttleFraction = 1.0f; ! SetAltitude(k.mfAlt_m - 200.0f); // max throttle and dive to get out of stall } float netForce_N = fThrust_N - fDrag_N - inducedDrag_N - weight_N *sinf(k.mfClimbAngle_rad); --- 240,266 ---- float lift_N = weight_N * cosf(k.mfClimbAngle_rad); float Cl = lift_N / (rhv2 * mpDBObject->mfWingArea_sm); ! float inducedDrag_N; ! if (Cl > mpDBObject->mfMaxCl) { throttleFraction = 1.0f; ! SetAltitude(k.mfAlt_m - 50.0f*mpDBObject->mfMaxCl); // max throttle and dive to get out of stall ! Cl = mpDBObject->mfMaxCl; ! inducedDrag_N = 0; // stall, no induced drag ! } ! else if (Cl > 0.9f*mpDBObject->mfMaxCl) { throttleFraction = 1.0f; ! SetAltitude(k.mfAlt_m - 500.0f*(Cl-0.9f*mpDBObject->mfMaxCl)); // max throttle and dive to avoid impending stall ! inducedDrag_N = mpDBObject->mfKdi * Cl * Cl * lift_N; ! } ! else ! { ! inducedDrag_N = mpDBObject->mfKdi * Cl * Cl * lift_N; } + angleOfAttack = Cl*liftCoeffToAoa; + float netForce_N = fThrust_N - fDrag_N - inducedDrag_N - weight_N *sinf(k.mfClimbAngle_rad); Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcAirObject.cpp 8 Dec 2003 03:06:36 -0000 1.5 --- tcAirObject.cpp 29 Jan 2004 00:05:38 -0000 1.6 *************** *** 24,28 **** #endif ! #include "tcairobject.h" /******************************************************************************/ --- 24,29 ---- #endif ! #include "tcAirObject.h" ! #include "tcGenericDBObject.h" /******************************************************************************/ *************** *** 179,183 **** dh = heading_end - heading_start; ! if (dh == 0) { // skip rest of function if no heading change mcKin.mfRoll_rad = 0; return; --- 180,185 ---- dh = heading_end - heading_start; ! if ((dh <= 0.00004)&&(dh >= -0.00004)) // skip rest of function if negligible heading change ! { mcKin.mfRoll_rad = 0; return; *************** *** 190,193 **** --- 192,196 ---- // if heading rate exceeds max due to roll rate limit then restrict heading rate float droll_max = 80.0f*C_PIOVER180*dt_s; + float roll_max = roll_start + droll_max; float roll_min = roll_start - droll_max; Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCreditView.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcCreditView.cpp 14 Jan 2004 01:13:22 -0000 1.7 --- tcCreditView.cpp 29 Jan 2004 00:05:38 -0000 1.8 *************** *** 36,44 **** using namespace Gdiplus; ! void tcCreditView::AddCredit(tcString& s, float afTrailSpace, bool abBold) { if (mnCredits >= MAX_CREDITS) {return;} maCredit[mnCredits].mfTrailSpace = afTrailSpace; ! maCredit[mnCredits].mbBold = abBold; maCredit[mnCredits++].mzCaption = s; } --- 36,44 ---- using namespace Gdiplus; ! 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; } *************** *** 49,148 **** s = "------- C R E D I T S -------"; ! AddCredit(s, 40.0f, true); s = "Dewitt \"Cole\" Colclough"; ! AddCredit(s, 25.0f, true); s = "Project manager and lead developer\n"; ! AddCredit(s, 80.0f, false); s = "Marcelo C\341ceres (op4_delta)"; ! AddCredit(s, 25.0f, true); s = "3D art"; ! AddCredit(s, 60.0f, false); s = "Marco Belli"; ! AddCredit(s, 25.0f, true); s = "Developer - Sound, Linux port"; ! AddCredit(s, 60.0f, false); s = "Jason Morris"; ! AddCredit(s, 25.0f, true); s = "Developer"; ! AddCredit(s, 60.0f, false); - s = "Testers\n...\n"; - AddCredit(s, 60.0f, false); s = "Some 2D art courtesy of U.S. Navy, www.news.navy.mil/view_galleries.asp \n"; ! AddCredit(s, 60.0f, false); s = "3D sky code\n"; ! AddCredit(s, 25.0f, false); s = "Combat Simulator Project, csp.sourceforge.net \n"; ! AddCredit(s, 60.0f, true); 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, false); s = "Thanks to the developers of these software libraries:\n"; ! AddCredit(s, 30.0f, false); s = "wxWindows\n"; ! AddCredit(s, 20.0f, false); s = "www.wxwindows.org\n"; ! AddCredit(s, 30.0f, false); s = "Python 2.3\n"; ! AddCredit(s, 20.0f, false); s = "www.python.org\n"; ! AddCredit(s, 30.0f, false); s = "Boost Python\n"; ! AddCredit(s, 20.0f, false); s = "www.boost.org\n"; ! AddCredit(s, 30.0f, false); s = "OpenSceneGraph\n"; ! AddCredit(s, 20.0f, false); s = "openscenegraph.sourceforge.net\n"; ! AddCredit(s, 60.0f, false); s = "Special thanks to:"; ! AddCredit(s, 30.0f, false); s = "Harpoon HQ, www.harpoonhq.com\n"; ! AddCredit(s, 30.0f, false); s = "Mille-Sabords, www.mille-sabords.com\n"; ! AddCredit(s, 30.0f, false); s = "Seawolves Surface Division, www.seawolves.org/fc\n"; ! AddCredit(s, 30.0f, false); s = "and\n"; ! AddCredit(s, 30.0f, false); s = "To those who offered advice through e-mail and \nthe global_conflict discussion group"; ! AddCredit(s, 50.0f, false); s = "GLOBAL CONFLICT BLUE"; ! AddCredit(s, 20.0f, false); s = "An open source project"; ! AddCredit(s, 20.0f, false); ! s = "www.gcblue.sourceforge.net"; ! AddCredit(s, 20.0f, false); s = "Copyright (C) 2002-2004, All rights reserved.\n"; ! AddCredit(s, 60.0f, false); --- 49,160 ---- 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); *************** *** 158,161 **** --- 170,179 ---- 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) { *************** *** 194,198 **** ! float fY = (float)mnHeight - 0.5f*(float)nDeltaTime; float fX = 0.5f*(float)mnWidth; --- 212,216 ---- ! float fY = (float)mnHeight - 2*0.5f*(float)nDeltaTime; float fX = 0.5f*(float)mnWidth; *************** *** 244,248 **** } else if (fY <= (float)mnHeight) { ! if (n > nFlashId) { nFlashId = n; bFlash = true; --- 262,266 ---- } else if (fY <= (float)mnHeight) { ! if ((n > nFlashId)&&(maCredit[n].mnEffect == 1)) { nFlashId = n; bFlash = true; *************** *** 251,255 **** bFlash = false; } ! Font *pFont = (maCredit[n].mbBold) ? mpFontLarge : mpFont; mpBrush->SetColor(Color(nColorFade)); // font color --- 269,282 ---- 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 *************** *** 283,287 **** } ! void tcCreditView::Rewind() { mnStartTime = mcTime.snCount_30Hz; mbDrawRewind = true; --- 310,315 ---- } ! void tcCreditView::Rewind() ! { mnStartTime = mcTime.snCount_30Hz; mbDrawRewind = true; *************** *** 299,302 **** --- 327,332 ---- { mpFont = NULL; + mpFontLarge = NULL; + mpFontSmall = NULL; mpBrush = NULL; mpSound = NULL; *************** *** 308,311 **** --- 338,342 ---- 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: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcFlightPort.cpp 5 Jan 2004 02:48:03 -0000 1.5 --- tcFlightPort.cpp 29 Jan 2004 00:05:38 -0000 1.6 *************** *** 31,34 **** --- 31,35 ---- #include "tcAirObject.h" #include "tcFlightportDBObject.h" + #include "tcGenericDBObject.h" Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcLauncherState.cpp 4 Jan 2004 22:24:53 -0000 1.2 --- tcLauncherState.cpp 29 Jan 2004 00:05:40 -0000 1.3 *************** *** 19,22 **** --- 19,27 ---- #include "tcLauncherState.h" + #include "tcDatabase.h" + #include "tcGenericDBObject.h" + #include "tcLauncherDBObject.h" + #include "tcMissileDBObject.h" + #include "tcRadarSensorState.h" tcDatabase* tcLauncherState::mpDatabase; *************** *** 36,39 **** --- 41,45 ---- return; } + if (mnCount >= tcGenericDBObject::MAXLAUNCHERS) { *************** *** 56,84 **** return; } ! ma[mnCount].mnChildDBKey = nChildKey; ! ma[mnCount].mpChildDBObj = pChildDBObj; ! ma[mnCount].mnDBKey = anKey; ! ma[mnCount].mpLauncherDBObj = ldata; ! ma[mnCount].mbActive = 1; ! ma[mnCount].mnCurrent = ldata->mnCapacity; ! ma[mnCount].mfTimeToReady = 0; ! ma[mnCount].msDatum.mfLon_rad=0; ! ma[mnCount].msDatum.mfLat_rad=0; ! ma[mnCount].mnTargetID=NULL_INDEX; ! ma[mnCount].meLaunchMode = AUTO; ! ma[mnCount].mnPending = 0; ! ma[mnCount].pointingAngle = azimuth_rad; // set detailed launch mode if missile tcMissileDBObject* pMissileDBObj = dynamic_cast<tcMissileDBObject*>(pDatabase->GetObject(nChildKey)); if (pMissileDBObj != NULL) { ! ma[mnCount].meLaunchMode = pMissileDBObj->GetLaunchMode(); ! ma[mnCount].mnTargetFlags = pMissileDBObj->mnTargetFlags; } else { ! ma[mnCount].mnTargetFlags = LAND_TARGET; } ! mnCount++; } --- 62,113 ---- return; } ! ! tsLData new_launcher; ! ! new_launcher.mnChildDBKey = nChildKey; ! new_launcher.mpChildDBObj = pChildDBObj; ! new_launcher.mnDBKey = anKey; ! new_launcher.mpLauncherDBObj = ldata; ! new_launcher.mbActive = 1; ! new_launcher.mnCurrent = ldata->mnCapacity; ! new_launcher.mfTimeToReady = 0; ! new_launcher.msDatum.mfLon_rad=0; ! new_launcher.msDatum.mfLat_rad=0; ! new_launcher.mnTargetID=NULL_INDEX; ! new_launcher.meLaunchMode = AUTO; ! new_launcher.mnPending = 0; ! new_launcher.pointingAngle = azimuth_rad; ! new_launcher.fireControlSensor = NULL; // set detailed launch mode if missile tcMissileDBObject* pMissileDBObj = dynamic_cast<tcMissileDBObject*>(pDatabase->GetObject(nChildKey)); if (pMissileDBObj != NULL) { ! new_launcher.meLaunchMode = pMissileDBObj->GetLaunchMode(); ! new_launcher.mnTargetFlags = pMissileDBObj->mnTargetFlags; } else { ! new_launcher.mnTargetFlags = LAND_TARGET; } ! launchers.push_back(new_launcher); ! mnCount = (int)launchers.size(); ! } ! ! ! int tcLauncherState::GetLauncherQuantity(unsigned anLauncher) ! { ! if (anLauncher > launchers.size()) {return -1;} ! return launchers[anLauncher].mnCurrent - launchers[anLauncher].mnPending; ! } ! ! bool tcLauncherState::IsDatumLaunch(unsigned anLauncher) ! { ! if (anLauncher > launchers.size()) {return false;} ! return launchers[anLauncher].meLaunchMode == DATUM_ONLY; ! } ! bool tcLauncherState::IsSeekerLaunch(unsigned anLauncher) ! { ! if (anLauncher > launchers.size()) {return false;} ! return launchers[anLauncher].meLaunchMode == SEEKER_TRACK; } *************** *** 93,96 **** --- 122,126 ---- for(int i=0;(i<mnCount)&&(i<tcGenericDBObject::MAXLAUNCHERS);i++) { + /* file.Read(&ma[i],sizeof(tsLData)); // replace serialized pointer *************** *** 98,105 **** --- 128,137 ---- ma[i].mpLauncherDBObj = dynamic_cast<tcLauncherDBObject*>(pDatabaseObj); ma[i].mpChildDBObj = mpDatabase->GetObject(ma[i].mnChildDBKey); + */ } } else { + /* file.Write(&mnCount,sizeof(mnCount)); for(int i=0;(i<mnCount)&&(i<tcGenericDBObject::MAXLAUNCHERS);i++) *************** *** 107,110 **** --- 139,143 ---- file.Write(&ma[i],sizeof(tsLData)); } + */ } } *************** *** 116,125 **** { std::string s; ! if ((int)anLauncher > mnCount) { s = "err"; return s; } ! teWeaponLaunchMode lm = ma[anLauncher].meLaunchMode; if (lm == DATUM_ONLY) { --- 149,158 ---- { std::string s; ! if (anLauncher > launchers.size()) { s = "err"; return s; } ! teWeaponLaunchMode lm = launchers[anLauncher].meLaunchMode; if (lm == DATUM_ONLY) { *************** *** 143,146 **** --- 176,180 ---- { mnCount = 0; + launchers.clear(); } *************** *** 150,163 **** tcLauncherState::tcLauncherState(tcLauncherState& lstate) { ! for(int i=0;i<tcGenericDBObject::MAXLAUNCHERS;i++) { ! ma[i].mnDBKey = lstate.ma[i].mnDBKey; ! ma[i].mbActive = lstate.ma[i].mbActive; ! ma[i].mnCurrent = lstate.ma[i].mnCurrent; ! ma[i].mfTimeToReady = lstate.ma[i].mfTimeToReady; ! ma[i].mnTargetID = lstate.ma[i].mnTargetID; ! ma[i].msDatum = lstate.ma[i].msDatum; } ! mnCount = lstate.mnCount; } --- 184,192 ---- tcLauncherState::tcLauncherState(tcLauncherState& lstate) { ! for(unsigned i=0;i<lstate.launchers.size();i++) { ! launchers.push_back(lstate.launchers[i]); } ! mnCount = (int)launchers.size(); } Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcMapView.cpp 20 Jan 2004 03:02:53 -0000 1.16 --- tcMapView.cpp 29 Jan 2004 00:05:40 -0000 1.17 *************** *** 1272,1275 **** --- 1272,1277 ---- } + + /***********************************************************************************/ int tcTacticalMapView::Hook(wxPoint pscreen) *************** *** 1288,1294 **** --- 1290,1318 ---- return mnHookID; + } + + /***********************************************************************************/ + long tcTacticalMapView::HookSecondary(wxPoint pscreen) + { + long nMinID; + if (mnHookID == NULL_INDEX) return -1; + nMinID = GetClosest(pscreen); + + if ((nMinID != (long)mnHookID) && (nMinID != -1)) + { + wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_SECONDARYHOOK) ; + command.SetEventObject(this); + command.m_extraLong = nMinID; + AddPendingEvent(command); + return nMinID; + } + else + { + return -1; + } } + /***********************************************************************************/ int tcTacticalMapView::GetClosest(wxPoint pscreen) { *************** *** 1299,1303 **** // search for hook ! fHookDistance = mfScale_radppel*15.0f; // 15 pixels fMinDistance = 1e15f; nMinID = NULL_INDEX; --- 1323,1327 ---- // search for hook ! fHookDistance = mfScale_radppel*16.0f; // 16 pixels fMinDistance = 1e15f; nMinID = NULL_INDEX; *************** *** 1330,1337 **** dx = sinf(fDirection_rad)*dr; dy = cosf(fDirection_rad)*dr; ! mrectCurrentView.Offset(dx,dy); ! mrectViewBounds.ApplyBounds(mrectCurrentView); ! CalcViewParameters(); } --- 1354,1363 ---- dx = sinf(fDirection_rad)*dr; dy = cosf(fDirection_rad)*dr; + + tcPoint p; + p.x = mrectCurrentView.XCenter() + dx; + p.y = mrectCurrentView.YCenter() + dy; ! SetView(p, mrectCurrentView.Width()); } *************** *** 1486,1491 **** return; // old returned true } ! ! tcWindow::SkipMouseEvent(event); return; // old returned false } --- 1512,1519 ---- return; // old returned true } ! if ((mnHookID == NULL_INDEX)||(HookSecondary(point) == -1)) ! { ! tcWindow::SkipMouseEvent(event); ! } return; // old returned false } Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcMissileObject.cpp 4 Jan 2004 22:24:53 -0000 1.4 --- tcMissileObject.cpp 29 Jan 2004 00:05:43 -0000 1.5 *************** *** 142,146 **** ! if (msKState.mfAltitude_m <= 12.0) { if (fInterceptPitch_rad < 0) {fInterceptPitch_rad = 0;} --- 142,146 ---- ! if (msKState.mfAltitude_m <= 4.0) { if (fInterceptPitch_rad < 0) {fInterceptPitch_rad = 0;} Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcObjectControl.cpp 4 Jan 2004 22:24:53 -0000 1.9 --- tcObjectControl.cpp 29 Jan 2004 00:05:45 -0000 1.10 *************** *** 659,668 **** for(int i=0;i<mnLaunchers;i++) { ! tsLData *pLauncher = &pLauncherState->ma[i]; int nLaunchCount = pLauncher->mnCurrent; mpSS->mpDatabase->GetObjectClass(pLauncher->mnChildDBKey,zClass); mcWeaponPanel.SetCaption(zClass.mz, i, 0); mcWeaponPanel.mastrCaption[i][1].Format("%d",nLaunchCount); ! switch(pLauncherState->ma[i].meLaunchMode) { case AUTO: --- 659,668 ---- for(int i=0;i<mnLaunchers;i++) { ! tsLData *pLauncher = &pLauncherState->launchers[i]; int nLaunchCount = pLauncher->mnCurrent; mpSS->mpDatabase->GetObjectClass(pLauncher->mnChildDBKey,zClass); mcWeaponPanel.SetCaption(zClass.mz, i, 0); mcWeaponPanel.mastrCaption[i][1].Format("%d",nLaunchCount); ! switch(pLauncherState->launchers[i].meLaunchMode) { case AUTO: *************** *** 1490,1494 **** { tcSensorState *pSensorState = pSS->at(i); ! tcRadarSensorState *pRadarSS = dynamic_cast<tcRadarSensorState*>(pSensorState); bool bActive = pSensorState->mbActive ? true : false; if ((pRadarSS)&&(bActive)) --- 1490,1494 ---- { tcSensorState *pSensorState = pSS->at(i); ! tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorState); bool bActive = pSensorState->mbActive ? true : false; if ((pRadarSS)&&(bActive)) Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcPlatformObject.cpp 16 Jan 2004 00:04:14 -0000 1.10 --- tcPlatformObject.cpp 29 Jan 2004 00:05:45 -0000 1.11 *************** *** 25,28 **** --- 25,30 ---- #include "tcPlatformObject.h" + #include "tcGenericDBObject.h" + #include "tcLauncherDBObject.h" #include "tcString.h" #include "tcRadarSensorState.h" *************** *** 44,55 **** } ! void tcPlatformObject::DesignateLauncherDatum(tcPoint p, unsigned int anLauncher) { if (anLauncher >= (unsigned)mcLauncherState.mnCount) {return;} ! mcLauncherState.ma[anLauncher].msDatum.Set(p.x, p.y); } ! void tcPlatformObject::DesignateLauncherTarget(tnPoolIndex anID, unsigned anLauncher) { if (anLauncher >= (unsigned)mcLauncherState.mnCount) {return;} ! mcLauncherState.ma[anLauncher].mnTargetID = anID; } --- 46,59 ---- } ! void tcPlatformObject::DesignateLauncherDatum(tcPoint p, unsigned int anLauncher) ! { if (anLauncher >= (unsigned)mcLauncherState.mnCount) {return;} ! mcLauncherState.launchers[anLauncher].msDatum.Set(p.x, p.y); } ! void tcPlatformObject::DesignateLauncherTarget(tnPoolIndex anID, unsigned anLauncher) ! { if (anLauncher >= (unsigned)mcLauncherState.mnCount) {return;} ! mcLauncherState.launchers[anLauncher].mnTargetID = anID; } *************** *** 121,125 **** const float dh_thresh = 10.0f*C_PIOVER180; const float k_dh = 1.0f/dh_thresh; ! if (absdh_rad < dh_thresh) { dh_max *= absdh_rad*k_dh; } --- 125,130 ---- const float dh_thresh = 10.0f*C_PIOVER180; const float k_dh = 1.0f/dh_thresh; ! if (absdh_rad < dh_thresh) ! { dh_max *= absdh_rad*k_dh; } *************** *** 128,131 **** --- 133,148 ---- if (dh_rad < dh_min) {dh_rad = dh_min;} // restrict to turn rate else if (dh_rad > dh_max) {dh_rad = dh_max;} + + + // simple way to smooth heading rate changes when not near goal + if (absdh_rad > dh_thresh) + { + float ddh_rad = dh_rad - lastHeadingDelta; + const float ddh_max = 0.0002f; + if (ddh_rad < -ddh_max) dh_rad = lastHeadingDelta - ddh_max; + else if (ddh_rad > ddh_max) dh_rad = lastHeadingDelta + ddh_max; + } + + lastHeadingDelta = dh_rad; mcKin.mfHeading_rad += dh_rad; *************** *** 159,167 **** /*** update launcher state (reload time) ***/ ! void tcPlatformObject::UpdateLauncherState(float dt_s) { ! for(int i=0;i<mcLauncherState.mnCount;i++) { ! if (mcLauncherState.ma[i].mbActive) { ! if (mcLauncherState.ma[i].mfTimeToReady > 0) { ! mcLauncherState.ma[i].mfTimeToReady -= dt_s; } } --- 176,188 ---- /*** update launcher state (reload time) ***/ ! void tcPlatformObject::UpdateLauncherState(float dt_s) ! { ! for(int i=0;i<mcLauncherState.mnCount;i++) ! { ! if (mcLauncherState.launchers[i].mbActive) ! { ! if (mcLauncherState.launchers[i].mfTimeToReady > 0) ! { ! mcLauncherState.launchers[i].mfTimeToReady -= dt_s; } } *************** *** 213,217 **** for (int k=0;k<nSensors;k++) { tcSensorState *pSensorState = mapSensorState[k]; ! if (dynamic_cast<tcRadarSensorState*>(pSensorState)) { if (pSensorState->mbActive) {return true;} } --- 234,238 ---- for (int k=0;k<nSensors;k++) { tcSensorState *pSensorState = mapSensorState[k]; ! if (dynamic_cast<tcRadar*>(pSensorState)) { if (pSensorState->mbActive) {return true;} } *************** *** 229,232 **** --- 250,254 ---- mcAI.ClearOrders(); fuel_kg = 0; + lastHeadingDelta = 0; } /******************************************************************************/ *************** *** 236,244 **** tsLData *pLauncher; ! for (int n=0;n<nLaunchers;n++) { ! pLauncher = &mcLauncherState.ma[n]; ! if ((pLauncher->mbActive)&&(pLauncher->mnPending > 0)) { bool bLaunch = (pLauncher->mnCurrent > 0)&&(pLauncher->mfTimeToReady <= 0); ! if (bLaunch) { pLauncher->mnCurrent--; pLauncher->mnPending--; --- 258,269 ---- tsLData *pLauncher; ! for (int n=0;n<nLaunchers;n++) ! { ! pLauncher = &mcLauncherState.launchers[n]; ! if ((pLauncher->mbActive)&&(pLauncher->mnPending > 0)) ! { bool bLaunch = (pLauncher->mnCurrent > 0)&&(pLauncher->mfTimeToReady <= 0); ! if (bLaunch) ! { pLauncher->mnCurrent--; pLauncher->mnPending--; *************** *** 276,280 **** if ((anLauncher<0)||(anLauncher>=mcLauncherState.mnCount)) {return;} ! pLauncher = &mcLauncherState.ma[anLauncher]; if (!pLauncher->mbActive) {return;} pLauncher->mnPending += anQuantity; --- 301,305 ---- if ((anLauncher<0)||(anLauncher>=mcLauncherState.mnCount)) {return;} ! pLauncher = &mcLauncherState.launchers[anLauncher]; if (!pLauncher->mbActive) {return;} pLauncher->mnPending += anQuantity; *************** *** 304,307 **** --- 329,333 ---- mcGS.SetAltitude(mcKin.mfAlt_m); fuel_kg = mpDBObject->mfFuelCapacity_kg; + lastHeadingDelta = 0; } *************** *** 321,327 **** } ! for(int i=0;i<nLaunchers;i++) { ! s.Format(" LAU%d: %s x %d\n",i,mcLauncherState.ma[i].mpLauncherDBObj->mzChildClass.mz, ! mcLauncherState.ma[i].mnCurrent); file.WriteString(s.GetBuffer()); } --- 347,354 ---- } ! for(int i=0;i<nLaunchers;i++) ! { ! s.Format(" LAU%d: %s x %d\n",i,mcLauncherState.launchers[i].mpLauncherDBObj->mzChildClass.mz, ! mcLauncherState.launchers[i].mnCurrent); file.WriteString(s.GetBuffer()); } *************** *** 434,438 **** if (tcRadarDBObject *pRadarDBObj = dynamic_cast<tcRadarDBObject*>(pDBObj)) { ! tcRadarSensorState *pRadarSS = new tcRadarSensorState; pRadarSS->InitFromDB(database, nSensorKey, lookAz_rad); pRadarSS->mpDBObj = pRadarDBObj; --- 461,465 ---- if (tcRadarDBObject *pRadarDBObj = dynamic_cast<tcRadarDBObject*>(pDBObj)) { ! tcRadar *pRadarSS = new tcRadar; pRadarSS->InitFromDB(database, nSensorKey, lookAz_rad); pRadarSS->mpDBObj = pRadarDBObj; *************** *** 457,460 **** --- 484,489 ---- } model->SetupAnimation(this); + + lastHeadingDelta = 0; } /******************************************************************************/ Index: tcRadarSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadarSensorState.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcRadarSensorState.cpp 4 Jan 2004 22:24:53 -0000 1.2 --- tcRadarSensorState.cpp 29 Jan 2004 00:05:45 -0000 1.3 *************** *** 21,29 **** #include "nsNav.h" #include "tcRadarSensorState.h" /** * */ ! bool tcRadarSensorState::InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad) { tcSensorState::InitFromDB(apDatabase, anKey, mountAzimuth_rad); --- 21,37 ---- #include "nsNav.h" #include "tcRadarSensorState.h" + #include "tcGameObject.h" + #include "tcSurfaceObject.h" + #include "tcAirObject.h" + #include "tcMissileObject.h" + #include "tcGenericDBObject.h" + #include "tcMissileDBObject.h" + + // break up this file later /** * */ ! bool tcRadar::InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad) { tcSensorState::InitFromDB(apDatabase, anKey, mountAzimuth_rad); *************** *** 32,36 **** if (mpDBObj == NULL) { ! WTL("Error - tcRadarSensorState::InitFromDB - Not found in db or bad class for key"); return false; } --- 40,44 ---- if (mpDBObj == NULL) { ! WTL("Error - tcRadar::InitFromDB - Not found in db or bad class for key"); return false; } *************** *** 43,47 **** * */ ! bool tcRadarSensorState::IsDetected(const tsRadarTargetInfo& asRTI, float& rfRange_km) { float fTargetAz_rad; --- 51,55 ---- * */ ! bool tcRadar::CanDetectTarget(const tcGameObject* target, float& range_km) { float fTargetAz_rad; *************** *** 54,57 **** --- 62,91 ---- return false; } + bool isSurface = false; + bool isAir = false; + float rcs_dBsm; + if (const tcSurfaceObject* surfaceObj = dynamic_cast<const tcSurfaceObject*>(target)) + { + rcs_dBsm = surfaceObj->mpDBObject->mfRcs_dbsm; + isSurface = true; + } + else if (const tcAirObject* airObj = dynamic_cast<const tcAirObject*>(target)) + { + rcs_dBsm = airObj->mpDBObject->mfRcs_dbsm; + isAir = true; + } + else if (const tcMissileObject* missileObj = dynamic_cast<const tcMissileObject*>(target)) + { + rcs_dBsm = missileObj->mpDBObject->mfRcs_dbsm; + isAir = true; + } + else + { + std::cerr << "CanDetectTarget called with illegal target class\n"; + return false; + } + + + const tcKinematics *kin = &target->mcKin; if (mpDBObj->mfFieldOfView_deg >= 360.0f) { *************** *** 61,86 **** { fTargetAz_rad = nsNav::GCHeadingApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, ! asRTI.mfLat_rad,asRTI.mfLon_rad); float fHalfFOV_rad = 0.5f*C_PIOVER180*mpDBObj->mfFieldOfView_deg; fCoverageAz1 = mfLookAz_rad - fHalfFOV_rad; fCoverageAz2 = mfLookAz_rad + fHalfFOV_rad; bInSearchVolume = AngleWithinRange(fTargetAz_rad,fCoverageAz1,fCoverageAz2) != 0; ! if (!bInSearchVolume) {rfRange_km=0;return false;} } ! float fRadarHorizon = C_RADARHOR*(sqrtf(asRTI.mfAlt_m) +sqrtf(msCurrentPos.mfAlt_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, ! asRTI.mfLat_rad,asRTI.mfLon_rad); ! rfRange_km = fTargetRange_km; if (fTargetRange_km > fRadarHorizon) { return false; } ! if (40.0f*(log10f(mpDBObj->mfRefRange_km) - log10f(fTargetRange_km)) ! >= asRTI.mfRCS_dbsm) { ! bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && asRTI.mfAlt_m > 0) || ! (mpDBObj->mbDetectsSurface && asRTI.mfAlt_m == 0); return bTargetTypeMatch; // detected --- 95,120 ---- { fTargetAz_rad = nsNav::GCHeadingApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, ! kin->mfLat_rad,kin->mfLon_rad); float fHalfFOV_rad = 0.5f*C_PIOVER180*mpDBObj->mfFieldOfView_deg; fCoverageAz1 = mfLookAz_rad - fHalfFOV_rad; fCoverageAz2 = mfLookAz_rad + fHalfFOV_rad; bInSearchVolume = AngleWithinRange(fTargetAz_rad,fCoverageAz1,fCoverageAz2) != 0; ! if (!bInSearchVolume) {range_km=0;return false;} } ! float fRadarHorizon = C_RADARHOR*(sqrtf(kin->mfAlt_m) +sqrtf(msCurrentPos.mfAlt_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, ! kin->mfLat_rad,kin->mfLon_rad); ! range_km = fTargetRange_km; if (fTargetRange_km > fRadarHorizon) { return false; } ! if (40.0f*(log10f(mpDBObj->mfRefRange_km) - log10f(fTargetRange_km)) ! >= rcs_dBsm) { ! bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || ! (mpDBObj->mbDetectsSurface && isSurface); return bTargetTypeMatch; // detected *************** *** 93,97 **** * */ ! void tcRadarSensorState::Serialize(tcFile& file, bool mbLoad) { tcSensorState::Serialize(file, mbLoad); --- 127,131 ---- * */ ! void tcRadar::Serialize(tcFile& file, bool mbLoad) { tcSensorState::Serialize(file, mbLoad); *************** *** 101,105 **** * */ ! tcRadarSensorState& tcRadarSensorState::operator=(tcRadarSensorState& ss) { tcSensorState::operator =(ss); --- 135,139 ---- * */ ! tcRadar& tcRadar::operator=(tcRadar& ss) { tcSensorState::operator =(ss); *************** *** 112,118 **** * */ ! tcRadarSensorState* tcRadarSensorState::Clone(void) { ! tcRadarSensorState *pNew = new tcRadarSensorState(); *pNew = *this; return pNew; --- 146,152 ---- * */ ! tcRadar* tcRadar::Clone(void) { ! tcRadar *pNew = new tcRadar(); *pNew = *this; return pNew; *************** *** 120,126 **** /** * */ ! tcRadarSensorState::tcRadarSensorState() { mnMode = 0; // mode if mbActive --- 154,184 ---- /** + * @return true if track is available and radar can detect target. + */ + bool tcRadar::IsTrackAvailable(const tcGameObject* target) + { + return false; + } + + /** + * if track is available and detectable, reserve a track. + * The current approach to semi-active guidance is to require each + * missile to request one track per target, even if it is the same + * target as a pre-existing track. + */ + bool tcRadar::RequestTrack(const tcGameObject* target) + { + return false; + } + + bool tcRadar::ReleaseTrack() + { + return false; + } + + /** * */ ! tcRadar::tcRadar() { mnMode = 0; // mode if mbActive *************** *** 132,134 **** * */ ! tcRadarSensorState::~tcRadarSensorState() {} \ No newline at end of file --- 190,192 ---- * */ ! tcRadar::~tcRadar() {} \ No newline at end of file Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcSimState.cpp 20 Jan 2004 03:02:53 -0000 1.24 --- tcSimState.cpp 29 Jan 2004 00:05:45 -0000 1.25 *************** *** 126,130 **** * correctly. */ ! bool tcSimState::RadarCanDetect(tnPoolIndex anSensorKey, const tsRadarTargetInfo& asRTI, tsGeoPoint asSensorLocation, float afSensorAz) { --- 126,130 ---- * correctly. */ ! bool tcSimState::RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, tsGeoPoint asSensorLocation, float afSensorAz) { *************** *** 132,136 **** if (mcDefaultRadar.InitFromDB(mpDatabase,anSensorKey,0)==false) {return false;} mcDefaultRadar.UpdateCoverage(asSensorLocation,afSensorAz); ! return mcDefaultRadar.IsDetected(asRTI,fRange_km); } --- 132,136 ---- if (mcDefaultRadar.InitFromDB(mpDatabase,anSensorKey,0)==false) {return false;} mcDefaultRadar.UpdateCoverage(asSensorLocation,afSensorAz); ! return mcDefaultRadar.CanDetectTarget(target,fRange_km); } *************** *** 182,186 **** if (pLauncherState==NULL) {return false;} if (anLauncher>=(unsigned)pLauncherState->mnCount) {return false;} // invalid anLauncher ! tsLData *pLauncher = &pLauncherState->ma[anLauncher]; if (pLauncher->mnCurrent <= 0) {return false;} // launcher empty if (pLauncher->mfTimeToReady > 0) {return false;} // launcher not ready --- 182,186 ---- if (pLauncherState==NULL) {return false;} if (anLauncher>=(unsigned)pLauncherState->mnCount) {return false;} // invalid anLauncher ! tsLData *pLauncher = &pLauncherState->launchers[anLauncher]; if (pLauncher->mnCurrent <= 0) {return false;} // launcher empty if (pLauncher->mfTimeToReady > 0) {return false;} // launcher not ready *************** *** 194,209 **** tnPoolIndex nSensorKey = mpDatabase->GetKey(pMissileDBObj->maSensorClass[0]); - tsRadarTargetInfo sRTI; - sRTI.mfAlt_m = pTargetObj->mcKin.mfAlt_m; - sRTI.mfHeading_rad = pTargetObj->mcKin.mfHeading_rad; - sRTI.mfLat_rad= (float)pTargetObj->mcKin.mfLat_rad; - sRTI.mfLon_rad= (float)pTargetObj->mcKin.mfLon_rad; - sRTI.mfRCS_dbsm = 0; // TODO: add RCS - sRTI.mfSpeed_mps = pTargetObj->mcKin.mfSpeed_kts*C_KTSTOMPS; float fSeekerAz = po->mcKin.mfHeading_rad; // TODO: add launcher angle effect tsGeoPoint sSeekerLoc; sSeekerLoc.Set((float)po->mcKin.mfLon_rad,(float)po->mcKin.mfLat_rad); ! bool bCanDetect = RadarCanDetect(nSensorKey,sRTI,sSeekerLoc,fSeekerAz); ! if (bCanDetect) { pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { --- 194,203 ---- tnPoolIndex nSensorKey = mpDatabase->GetKey(pMissileDBObj->maSensorClass[0]); float fSeekerAz = po->mcKin.mfHeading_rad; // TODO: add launcher angle effect tsGeoPoint sSeekerLoc; sSeekerLoc.Set((float)po->mcKin.mfLon_rad,(float)po->mcKin.mfLat_rad); ! bool bCanDetect = RadarCanDetect(nSensorKey,pTargetObj,sSeekerLoc,fSeekerAz); ! if (bCanDetect) ! { pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { *************** *** 484,488 **** apGameObj->GetLauncherState(pLauncherState); if (pLauncherState == NULL) {return false;} ! pLauncher = &pLauncherState->ma[anLauncher]; int nLaunchCount = pLauncher->mnCurrent - pLauncher->mnPending; --- 478,482 ---- apGameObj->GetLauncherState(pLauncherState); if (pLauncherState == NULL) {return false;} ! pLauncher = &pLauncherState->launchers[anLauncher]; int nLaunchCount = pLauncher->mnCurrent - pLauncher->mnPending; *************** *** 533,537 **** bool bSearching = true; for(int n=0;(n<nLaunchers)&&(bSearching);n++) { ! tsLData *pLauncher = &pSurfaceObj->mcLauncherState.ma[n]; bool bLauncherReady = (pLauncher->mbActive)&& (pLauncher->mfTimeToReady <= 0)&& --- 527,531 ---- bool bSearching = true; for(int n=0;(n<nLaunchers)&&(bSearching);n++) { ! tsLData *pLauncher = &pSurfaceObj->mcLauncherState.launchers[n]; bool bLauncherReady = (pLauncher->mbActive)&& (pLauncher->mfTimeToReady <= 0)&& *************** *** 616,620 **** case SSMODE_FCSURVEILLANCE: { ! tcRadarSensorState *pRadarSS = dynamic_cast<tcRadarSensorState*>(pSensorState); if (pRadarSS) { UpdateFireControl(pplat,pRadarSS); --- 610,614 ---- case SSMODE_FCSURVEILLANCE: { ! tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorState); if (pRadarSS) { UpdateFireControl(pplat,pRadarSS); *************** *** 638,642 **** } else if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(pplat)) { ! tcRadarSensorState *pRadarSS = pMissileObj->GetSensorState(); if((pRadarSS!=NULL)&&(pRadarSS->UpdateScan(mfSimTime))) { switch (pRadarSS->mnMode) { --- 632,636 ---- } else if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(pplat)) { ! tcRadar *pRadarSS = pMissileObj->GetSensorState(); if((pRadarSS!=NULL)&&(pRadarSS->UpdateScan(mfSimTime))) { switch (pRadarSS->mnMode) { *************** *** 655,661 **** /********************************************************************/ void tcSimState::ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, ! tcRadarSensorState *apRadarSS) { - tsRadarTargetInfo sRTI; float fRange_km; --- 649,654 ---- /********************************************************************/ void tcSimState::ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, ! tcRadar *apRadarSS) { float fRange_km; *************** *** 663,671 **** if (apRadarPlat->mnAlliance == apTarget->mnAlliance) {return;} ! sRTI.mfLat_rad = (float)apTarget->mcKin.mfLat_rad; ! sRTI.mfLon_rad = (float)apTarget->mcKin.mfLon_rad; ! sRTI.mfAlt_m = apTarget->mcKin.mfAlt_m; ! sRTI.mfRCS_dbsm = 0; ! bool bDetected = apRadarSS->IsDetected(sRTI,fRange_km); if (!bDetected) {return;} --- 656,660 ---- if (apRadarPlat->mnAlliance == apTarget->mnAlliance) {return;} ! bool bDetected = apRadarSS->CanDetectTarget(apTarget,fRange_km); if (!bDetected) {return;} *************** *** 717,721 **** /********************************************************************/ ! bool tcSimState::IsDetectedESM(tcESMSensorState *apESM, tcRadarSensorState *apEmitterRadar, tcGameObject *apEmitterPlatform, float& rfAz_rad) { --- 706,710 ---- /********************************************************************/ ! bool tcSimState::IsDetectedESM(tcESMSensorState *apESM, tcRadar *apEmitterRadar, tcGameObject *apEmitterPlatform, float& rfAz_rad) { *************** *** 746,750 **** if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(apTarget)) { ! tcRadarSensorState *pRadarSS = pMissileObj->GetSensorState(); bDetected = IsDetectedESM(apESMSS, pRadarSS, apTarget, fAz_rad); if ((bDetected)&&(nEmitters < MAX_EMITTERS)) { --- 735,739 ---- if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(apTarget)) { ! tcRadar *pRadarSS = pMissileObj->GetSensorState(); bDetected = IsDetectedESM(apESMSS, pRadarSS, apTarget, fAz_rad); if ((bDetected)&&(nEmitters < MAX_EMITTERS)) { *************** *** 757,761 **** int nSensors = (int)pSensorArray->size(); for (int n=0;n<nSensors;n++) { ! tcRadarSensorState *pRadarSS = dynamic_cast<tcRadarSensorState*>(pSensorArray->at(n)); if (pRadarSS) { if (IsDetectedESM(apESMSS, pRadarSS, apTarget, fAz_rad)) { --- 746,750 ---- int nSensors = (int)pSensorArray->size(); for (int n=0;n<nSensors;n++) { ! tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorArray->at(n)); if (pRadarSS) { if (IsDetectedESM(apESMSS, pRadarSS, apTarget, fAz_rad)) { *************** *** 858,862 **** if (nTargetID != applat->mnID) { // no self detection pTarget = GetObject(nTargetID); ! tcRadarSensorState *pRadarSS = dynamic_cast<tcRadarSensorState*>(apSensorState); if (pRadarSS) { ProcessRadarDetection(applat,pTarget,pRadarSS); --- 847,851 ---- if (nTargetID != applat->mnID) { // no self detection pTarget = GetObject(nTargetID); ! tcRadar *pRadarSS = dynamic_cast<tcRadar*>(apSensorState); if (pRadarSS) { ProcessRadarDetection(applat,pTarget,pRadarSS); *************** *** 871,875 **** #define N_TARGET_KEYS 100 #define N_FC_KEYS 32 ! void tcSimState::UpdateFireControl(tcGameObject *apGameObj, tcRadarSensorState *apRadarSS) { tnPoolIndex aTargetKeys[N_TARGET_KEYS]; tnPoolIndex aFCKeys[N_FC_KEYS]; --- 860,864 ---- #define N_TARGET_KEYS 100 #define N_FC_KEYS 32 ! void tcSimState::UpdateFireControl(tcGameObject *apGameObj, tcRadar *apRadarSS) { tnPoolIndex aTargetKeys[N_TARGET_KEYS]; tnPoolIndex aFCKeys[N_FC_KEYS]; *************** *** 890,905 **** for(int k=0;(k<nCount)&&(nFCCount<N_FC_KEYS);k++) { nTargetID = aTargetKeys[k]; ! if (nTargetID != apGameObj->mnID) { // no self detection bool bDetected = false; int bTargetExists = maPlatformState.Lookup(nTargetID,pTargetObj); bool bOwnAlliance = (pTargetObj->mnAlliance == apGameObj->mnAlliance); float fRange_km; ! if ((bTargetExists)&&(!bOwnAlliance)) { // no own-alliance detections ! tsRadarTargetInfo sRTI; ! sRTI.mfLat_rad = (float)pTargetObj->mcKin.mfLat_rad; ! sRTI.mfLon_rad = (float)pTargetObj->mcKin.mfLon_rad; ! sRTI.mfAlt_m = pTargetObj->mcKin.mfAlt_m; ! sRTI.mfRCS_dbsm = 0; ! bDetected = apRadarSS->IsDetected(sRTI,fRange_km) == 1; } if (bDetected) { --- 879,891 ---- for(int k=0;(k<nCount)&&(nFCCount<N_FC_KEYS);k++) { nTargetID = aTargetKeys[k]; ! if (nTargetID != apGameObj->mnID) // no self detection ! { bool bDetected = false; int bTargetExists = maPlatformState.Lookup(nTargetID,pTargetObj); bool bOwnAlliance = (pTargetObj->mnAlliance == apGameObj->mnAlliance); float fRange_km; ! if ((bTargetExists)&&(!bOwnAlliance)) // no own-alliance detections ! { ! bDetected = apRadarSS->CanDetectTarget(pTargetObj,fRange_km) == 1; } if (bDetected) { *************** *** 1020,1024 **** } /********************************************************************/ ! void tcSimState::UpdateSeeker(tcGameObject *applat, tcRadarSensorState *apRadarSS) { long nTargetID; tsGeoPoint currentpos; --- 1006,1010 ---- } /********************************************************************/ ! void tcSimState::UpdateSeeker(tcGameObject *applat, tcRadar *apRadarSS) { long nTargetID; tsGeoPoint currentpos; *************** *** 1031,1035 **** float fRange,fMinRange; int bFound; - tsRadarTargetInfo sRTI; int bDetectable; --- 1017,1020 ---- *************** *** 1050,1059 **** bFound = maPlatformState.Lookup(nTargetID,ptarget); if (bFound) { // own-alliance is allowed - sRTI.mfLat_rad = (float)ptarget->mcKin.mfLat_rad; - sRTI.mfLon_rad = (float)ptarget->mcKin.mfLon_rad; - sRTI.mfAlt_m = ptarget->mcKin.mfAlt_m; - sRTI.mfRCS_dbsm = 0; float fRange_km; ! bDetectable = apRadarSS->IsDetected(sRTI,fRange_km); if (bDetectable) { // update track info --- 1035,1040 ---- bFound = maPlatformState.Lookup(nTargetID,ptarget); if (bFound) { // own-alliance is allowed float fRange_km; ! bDetectable = apRadarSS->CanDetectTarget(ptarget,fRange_km); if (bDetectable) { // update track info *************** *** 1100,1109 **** if (nTargetID != applat->mnID) { // no self detection bFound = maPlatformState.Lookup(nTargetID,ptarget); ! if (bFound) { ! sRTI.mfLat_rad = (float)ptarget->mcKin.mfLat_rad; ! sRTI.mfLon_rad = (float)ptarget->mcKin.mfLon_rad; ! sRTI.mfAlt_m = ptarget->mcKin.mfAlt_m; ! sRTI.mfRCS_dbsm = 0; ! bDetectable = apRadarSS->IsDetected(sRTI,fRange); // (tsGeoPoint,float rcs_dbsm) if ((bDetectable)&&(fRange<fMinRange)) { nMinID = nTargetID; --- 1081,1087 ---- if (nTargetID != applat->mnID) { // no self detection bFound = maPlatformState.Lookup(nTargetID,ptarget); ! if (bFound) ! { ! bDetectable = apRadarSS->CanDetectTarget(ptarget,fRange); // (tsGeoPoint,float rcs_dbsm) if ((bDetectable)&&(fRange<fMinRange)) { nMinID = nTargetID; *************** *** 1166,1170 **** plaunchingplatform->GetLauncherState(pLauncherState); if (pLauncherState != NULL) { ! tsLData *pLauncher = &pLauncherState->ma[anLauncher]; if (pLauncher->meLaunchMode == DATUM_ONLY) { pMissileObj->msWaypoint = pLauncher->msDatum; --- 1144,1148 ---- plaunchingplatform->GetLauncherState(pLauncherState); if (pLauncherState != NULL) { ! tsLData *pLauncher = &pLauncherState->launchers[anLauncher]; if (pLauncher->meLaunchMode == DATUM_ONLY) { pMissileObj->msWaypoint = pLauncher->msDatum; Index: tcSurfaceObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSurfaceObject.cpp 8 Dec 2003 03:06:36 -0000 1.6 --- tcSurfaceObject.cpp 29 Jan 2004 00:05:54 -0000 1.7 *************** *** 26,29 **** --- 26,30 ---- #include "tcSurfaceObject.h" + #include "tcGenericDBObject.h" #include "tcMapData.h" |