[Gcblue-commits] gcb_wx/src/sim tcGameView.cpp,1.10,1.11 tcLauncherState.cpp,1.11,1.12 tcMapView.cpp
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28653/src/sim Modified Files: tcGameView.cpp tcLauncherState.cpp tcMapView.cpp tcMissileObject.cpp tcPlatformObject.cpp tcRadar.cpp tcSimState.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** tcSimState.cpp 18 Jul 2004 03:18:01 -0000 1.45 --- tcSimState.cpp 19 Jul 2004 00:53:01 -0000 1.46 *************** *** 193,197 **** } /********************************************************************/ ! void tcSimState::DesignateLauncherDatum(tnPoolIndex anKey, tcPoint p, unsigned anLauncher) { int bFound; --- 193,197 ---- } /********************************************************************/ ! void tcSimState::DesignateLauncherDatum(tnPoolIndex anKey, tsGeoPoint p, unsigned anLauncher) { int bFound; *************** *** 331,336 **** } /********************************************************************/ /** ! * break this up, too many nested conditionals */ void tcSimState::UpdateWeaponHits() --- 331,473 ---- } /********************************************************************/ + /** ! * Used for a missile that is guided with a sensor to a target. The ! * assumption is that the intended target is the only possible target ! * that can be hit. This saves time by not looking for nearby accidental ! * targets. ! */ ! void tcSimState::EvaluateGuidedMissileHit(tcMissileObject* missile, tcGameObject* target) ! { ! float range_m = 1000.0f*missile->mcKin.RangeToKmAlt(target->mcKin); ! float fFactor = 0.01f*(missile->mcKin.mfSpeed_kts + target->mcKin.mfSpeed_kts + 2000.0f); ! ! if (range_m >= fFactor) return; // too far away, no damage ! ! float dx, dy, dz, tclosest; ! tclosest = target->mcKin.CalculateCollisionPoint(missile->mcKin, dx, dy, dz); ! ! if (tclosest > 0.03) return; // defer until future time step ! ! float trueRange2 = dx*dx + dy*dy + dz*dz; ! if (trueRange2 < 64.0f) // 8.0 m range ! { ! tcString s; ! s.Format("weapon %d hit target %d, range^2: %3.1f m, time %.1f s", ! missile->mnID, target->mnID, trueRange2, mfSimTime); ! WTL(s.GetBuffer()); ! std::cout << s.GetBuffer(); ! fprintf(stdout," collision relative time: %f, dx:%f dy:%f dz:%f\n", ! tclosest, dx, dy, dz); ! ! float fDamage = missile->mpDBObject->mfDamage; ! float fDamageFract = GetFractionalDamage(fDamage, target); ! target->mfDamageLevel += fDamageFract; ! missile->mfDamageLevel += 1.0f; // missile destroys itself on impact ! ! if (fDamageFract > 0) ! { ! if (mpUserInfo->IsOwnAlliance(target->mnAlliance)) ! { ! tcSound::Get()->PlayEffect(SEFFECT_IMPLOSION); ! } ! else ! { ! tcSound::Get()->PlayEffect(SEFFECT_EXPLOSION2); ! } ! } ! } ! ! } ! ! /** ! * Used for a missile used against fixed land targets. The region near ! * the collision point is searched for nearby targets. Damage is applied ! * to all targets that are close enough. ! */ ! void tcSimState::EvaluateImpactMissileHit(tcMissileObject* missile) ! { ! wxASSERT(missile); ! ! float terrainHeight_m = missile->mcTerrain.mfHeight_m; ! if (missile->mcKin.mfAlt_m > terrainHeight_m + 25.0) return; ! ! const float blastHeight_m = 3.0f; // height above ground for detonation ! double lon_rad; ! double lat_rad; ! float tImpact = missile->mcKin.CalculateGroundImpactPoint( ! terrainHeight_m + blastHeight_m, lon_rad, lat_rad); ! ! if (tImpact > 0.03) return; // defer until future time step ! ! missile->mcKin.mfAlt_m = terrainHeight_m; ! missile->mcKin.mfLon_rad = lon_rad; ! missile->mcKin.mfLat_rad = lat_rad; ! ! ! ! float rLat = 500.0 * C_MTORAD; ! float rLon = rLat / cosf(missile->mcKin.mfLat_rad); ! ! long blastPlats[16]; ! ! tcRect blastRegion; ! float west = lon_rad - rLon; ! float east = lon_rad + rLon; ! float north = lat_rad + rLat; ! float south = lat_rad - rLat; ! if (west < -C_PI) west += C_TWOPI; ! if (east >= C_PI) east -= C_TWOPI; ! blastRegion.Set(west, east, south, north); ! ! int nPlats = GetPlatformsWithinRegion(blastPlats, 16, &blastRegion); ! float fDamage = missile->mpDBObject->mfDamage; ! ! for (int idx = 0; idx < nPlats; idx++) ! { ! tcGameObject* target = GetObject(blastPlats[idx]); ! if (target && (target->mnID != missile->mnID)) ! { ! float range_m = 1000.0f * target->mcKin.RangeToKmAlt(missile->mcKin); ! if (range_m <= 80.0) ! { ! float fDamageFract = GetFractionalDamage(fDamage, target); ! target->mfDamageLevel += fDamageFract; ! ! if (fDamageFract > 0) ! { ! tcString s; ! s.Format("weapon (impact) %d hit target %d, range: %3.1f m, time %.1f s", ! missile->mnID, target->mnID, range_m, mfSimTime); ! WTL(s.GetBuffer()); ! ! if (mpUserInfo->IsOwnAlliance(target->mnAlliance)) ! { ! tcSound::Get()->PlayEffect(SEFFECT_IMPLOSION); ! } ! else ! { ! tcSound::Get()->PlayEffect(SEFFECT_EXPLOSION2); ! } ! } ! } ! else ! { ! tcString s; ! s.Format("weapon (impact) %d missed target %d, range: %3.1f m, time %.1f s", ! missile->mnID, target->mnID, range_m, mfSimTime); ! WTL(s.GetBuffer()); ! } ! } ! } ! ! missile->mfDamageLevel += 1.0f; ! ! } ! ! ! /** ! * JUL2004 This was modified to use EvaluateGuidedMissileHit and ! * EvaluateImpactMissileHit. */ void tcSimState::UpdateWeaponHits() *************** *** 338,400 **** long aKeyList[512]; int nCount; - tcGameObject *pobj, *ptarget; tsGuidanceParameters gp; - int bFound; - float fRange_m; nCount = GetAllWeaponObjects(aKeyList,512); for(int k=0;k<nCount;k++) { ! bFound = maPlatformState.Lookup(aKeyList[k],pobj); ! tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(pobj); ! if (bFound&&(pMissileObj != NULL)) ! { ! bool bTarget = (pMissileObj->GetGuidanceParameters(gp) == 1); ! bFound = (bTarget) ? maPlatformState.Lookup(gp.mnTargetID,ptarget) : false; ! if (bFound) ! { ! fRange_m = 1000.0f*pobj->mcKin.RangeToKmAlt(ptarget->mcKin); ! float fFactor = 0.01f*(pobj->mcKin.mfSpeed_kts + ptarget->mcKin.mfSpeed_kts + 2000.0f); ! if (fRange_m < fFactor) ! { ! float dx,dy,dz,tclosest; ! tclosest = ptarget->mcKin.CalculateCollisionPoint(pMissileObj->mcKin, ! dx,dy,dz); ! if (tclosest <= 0.03) ! { ! float trueRange2 = dx*dx + dy*dy + dz*dz; ! if (trueRange2 < 64.0f) // 8.0 m range ! { ! tcString s; ! s.Format("weapon %d hit target %d, range^2: %3.1f m, time %.1f s", ! aKeyList[k],gp.mnTargetID,trueRange2,mfSimTime); ! WTL(s.GetBuffer()); ! std::cout << s.GetBuffer(); ! fprintf(stdout," collision relative time: %f, dx:%f dy:%f dz:%f\n", ! tclosest,dx,dy,dz); ! ! float fDamage = pMissileObj->mpDBObject->mfDamage; ! float fDamageFract = GetFractionalDamage(fDamage, ptarget); ! ptarget->mfDamageLevel += fDamageFract; ! pobj->mfDamageLevel += 1.0f; // missile destroys itself on impact ! ! if (fDamageFract > 0) ! { ! if (mpUserInfo->IsOwnAlliance(ptarget->mnAlliance)) ! { ! tcSound::Get()->PlayEffect(SEFFECT_IMPLOSION); ! } ! else ! { ! tcSound::Get()->PlayEffect(SEFFECT_EXPLOSION2); ! } ! } ! } ! } ! - } - } } } --- 475,507 ---- long aKeyList[512]; int nCount; tsGuidanceParameters gp; nCount = GetAllWeaponObjects(aKeyList,512); for(int k=0;k<nCount;k++) { ! tcGameObject* obj = GetObject(aKeyList[k]); + if (tcMissileObject* missileObj = dynamic_cast<tcMissileObject*>(obj)) + { + bool bTerminal = (missileObj->GetGuidanceParameters(gp) != 0); + if (gp.mnTargetID != -1) + { + if ((gp.mfInterceptTime < 10.0)) + { + if (tcGameObject* target = GetObject(gp.mnTargetID)) + { + EvaluateGuidedMissileHit(missileObj, target); + } + } + } + else + { + if (missileObj->mcKin.mfAlt_m < missileObj->mcTerrain.mfHeight_m + 200.0) + { + EvaluateImpactMissileHit(missileObj); + } + } + } } *************** *** 1181,1254 **** } /********************************************************************/ ! void tcSimState::AddLaunchedPlatform(long anNewKey, tcGameObject *plaunchingplatform, unsigned anLauncher) { ! tcGameObject *pnew; tcDatabaseObject *pDBObject; ! pDBObject = mpDatabase->GetObject(anNewKey); if (pDBObject == NULL) {return;} - // only missiles are supported with this (and not for long) - tcMissileDBObject *pMissileData = dynamic_cast<tcMissileDBObject*>(pDBObject); - wxASSERT(pMissileData); - - tcMissileObject* pMissileObj = dynamic_cast<tcMissileObject*>(CreateGameObject(pMissileData)); - if (pMissileObj == NULL) {return;} ! pMissileObj->msKState.mfAltitude_m = plaunchingplatform->mcKin.mfAlt_m; ! if (pMissileObj->msKState.mfAltitude_m < 5.0f) ! { ! pMissileObj->msKState.mfAltitude_m = 5.0f; ! } ! pMissileObj->msKState.mfSpeed_mps = plaunchingplatform->mcKin.mfSpeed_kts* ! (float)C_KTSTOMPS; ! tcLauncherState* pLauncherState; ! plaunchingplatform->GetLauncherState(pLauncherState); ! wxASSERT(pLauncherState); - const tcLauncher* pLauncher = pLauncherState->GetLauncher(anLauncher); ! pMissileObj->mfGoalHeading_rad = ! plaunchingplatform->mcKin.mfHeading_rad + pLauncher->pointingAngle; ! ! if (pLauncher->meLaunchMode == DATUM_ONLY) ! { ! pMissileObj->msWaypoint = pLauncher->msDatum; ! } ! else if ((pLauncher->meLaunchMode == SEEKER_TRACK) ! || (pLauncher->meLaunchMode == FC_TRACK)) ! { ! pMissileObj->msWaypoint = pLauncher->msDatum; ! pMissileObj->mcSensorState.SetActive(true); ! pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; ! pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; ! if (pMissileObj->mcSensorState.IsSemiactive()) ! { ! pMissileObj->mcSensorState.SetIlluminator( ! plaunchingplatform->mnID, pLauncher->fireControlSensorIdx); ! pLauncher->fireControlSensor->RequestTrack(); ! } ! } ! ! ! // 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; ! pnew->mcKin.mfHeading_rad += pLauncher->pointingAngle; ! ! // pnew->mcKin.mfHeading_rad += p ! tcString s; ! s.Format("From %s",plaunchingplatform->mzUnit.mz); ! 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)) { tcSound::Get()->PlayEffect(SEFFECT_MISSILELAUNCH); --- 1288,1316 ---- } /********************************************************************/ ! void tcSimState::AddLaunchedPlatform(long newKey, tcGameObject* launchingPlatform, ! unsigned nLauncher) ! { tcDatabaseObject *pDBObject; ! pDBObject = mpDatabase->GetObject(newKey); if (pDBObject == NULL) {return;} ! tcGameObject* launched = CreateGameObject(pDBObject); ! if (tcMissileObject* missile = dynamic_cast<tcMissileObject*>(launched)) ! { ! missile->LaunchFrom(launchingPlatform, nLauncher); ! } ! else ! { ! fprintf(stderr, ! "AddLaunchedPlatform - Unrecognized or NULL obj from CreateGameObject"); ! return; ! } ! ! if (mpUserInfo->IsOwnAlliance(launchingPlatform->mnAlliance)) { tcSound::Get()->PlayEffect(SEFFECT_MISSILELAUNCH); Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcMissileObject.cpp 4 Jun 2004 21:39:23 -0000 1.12 --- tcMissileObject.cpp 19 Jul 2004 00:53:01 -0000 1.13 *************** *** 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, [...1051 lines suppressed...] ! mfLastGuidanceUpdate = 0.0f; ! guidanceStatusTime = 0; ! // if these inits are missing, causes a crash with time accel after missile launch ! memset(&msKState,0x00,sizeof(msKState)); ! mfLastGuidanceUpdate = 0; ! mnCurrentSegment = 0; ! mfGoalPitch_rad = 0.01f; ! // init sensors, only one sensor (primary) supported in this version ! tnPoolIndex nSensorKey = database->GetKey(obj->maSensorClass[0]); ! mcSensorState.InitFromDB(database,nSensorKey, 0); // missile seeker always points forward ! mcSensorState.SetParent(this); } /** ! * ! */ tcMissileObject::~tcMissileObject() {} Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcLauncherState.cpp 4 Jun 2004 21:39:23 -0000 1.11 --- tcLauncherState.cpp 19 Jul 2004 00:53:01 -0000 1.12 *************** *** 120,123 **** --- 120,130 ---- } + tcLauncher* tcLauncherState::GetLauncher(unsigned int nLauncher) + { + if ((int)nLauncher >= mnCount) return 0; + + return &launchers[nLauncher]; + } + const tcLauncher* tcLauncherState::GetLauncher(unsigned nLauncher) const { *************** *** 386,390 **** * @return true if success */ ! bool tcLauncherState::SetLauncherDatum(unsigned nLauncher, double lon_rad, double lat_rad) { if (nLauncher > launchers.size()) --- 393,398 ---- * @return true if success */ ! bool tcLauncherState::SetLauncherDatum(unsigned nLauncher, ! double lon_rad, double lat_rad, float alt_m) { if (nLauncher > launchers.size()) *************** *** 393,397 **** return false; } ! launchers[nLauncher].msDatum.Set(lon_rad, lat_rad); commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; --- 401,405 ---- return false; } ! launchers[nLauncher].msDatum.Set(lon_rad, lat_rad, alt_m); commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; *************** *** 410,413 **** --- 418,423 ---- } launchers[nLauncher].mnTargetID = targetID; + launchers[nLauncher].msDatum.Set(0, 0, 0); // clear datum + commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcMapView.cpp 25 Jun 2004 01:40:27 -0000 1.27 --- tcMapView.cpp 19 Jul 2004 00:53:01 -0000 1.28 *************** *** 724,728 **** } ! void tcTacticalMapView::DrawNTDSSurface(Graphics *apGraphics, teAffiliation affil) { float symbsize=15.0f; float x = 12.0f; --- 724,729 ---- } ! void tcTacticalMapView::DrawNTDSSurface(Graphics *apGraphics, teAffiliation affil) ! { float symbsize=15.0f; float x = 12.0f; *************** *** 757,760 **** --- 758,807 ---- } + + /** + * NTDS ground is drawn as slightly smaller surface with horizontal bar + * underneath. This isn't a "real" NTDS symbol, but will stand-in until + * some more symbology work is done. + */ + void tcTacticalMapView::DrawNTDSGround(Graphics* graphics, teAffiliation affil) + { + float w = 10.0f; // symbol size + + // x and y normally set to center of image (image size / 2) + float x = 12.0f; + float y = 12.0f; + + switch (affil) + { + case FRIENDLY: + case NEUTRAL: + { + RectF rect(x-w/2.0f, y-w/2.0f, w, w); + graphics->DrawArc(mpPen,rect,0,360); + break; + } + case UNKNOWN: + { + float w = 9.0f; // make unknown box a little smaller to see bar underneath + graphics->DrawLine(mpPen, x-w/2, y+w/2, x-w/2, y-w/2); + graphics->DrawLine(mpPen, x+w/2, y+w/2, x+w/2, y-w/2); + graphics->DrawLine(mpPen, x-w/2, y-w/2, x+w/2, y-w/2); + graphics->DrawLine(mpPen, x-w/2, y+w/2, x+w/2, y+w/2); + + break; + } + case HOSTILE: + { + graphics->DrawLine(mpPen, x-w/2, y, x, y-w/2); + graphics->DrawLine(mpPen, x, y-w/2, x+w/2, y); + graphics->DrawLine(mpPen, x-w/2, y, x, y+w/2); + graphics->DrawLine(mpPen, x, y+w/2, x+w/2, y); + break; + } + } + graphics->DrawLine(mpPen, x-w/2, y+w/2+1, x+w/2, y+w/2+1); + } + + void tcTacticalMapView::DrawNTDSUnknown(Graphics *apGraphics, teAffiliation affil) { float symbsize=8.0f; *************** *** 852,856 **** Graphics *pGraphics; ! for (int nAffiliation=0;nAffiliation<4;nAffiliation++) { mpPen->SetColor(Color(GetAffiliationColor((teAffiliation)nAffiliation))); --- 899,904 ---- Graphics *pGraphics; ! for (int nAffiliation=0;nAffiliation<4;nAffiliation++) ! { mpPen->SetColor(Color(GetAffiliationColor((teAffiliation)nAffiliation))); *************** *** 861,864 **** --- 909,918 ---- delete pGraphics; + // fixed ground symbol + Image* pGround = pNull->Clone(); + pGraphics = GetGraphicsFromImage(pGround); + DrawNTDSGround(pGraphics, (teAffiliation)nAffiliation); + delete pGraphics; + // missile Image *pMissile = pNull->Clone(); *************** *** 911,914 **** --- 965,971 ---- pSymbol = pSurface; break; + case SYMBOL_FIXED: + pSymbol = pGround; + break; default: pSymbol = pUnknown; *************** *** 990,997 **** } ! Image* tcTacticalMapView::GetSymbol(teAffiliation aeAffiliation, teSymbol aeSymbol) { int nAffilIdx = (int)aeAffiliation; int nSymbolIdx = (int)aeSymbol; ! if (meSymbology == NTDS) { return maSymbolA[nAffilIdx][nSymbolIdx]; } --- 1047,1059 ---- } ! /** ! * @returns symbol image pointer based on symbology mode ! */ ! Image* tcTacticalMapView::GetSymbol(teAffiliation aeAffiliation, teSymbol aeSymbol) ! { int nAffilIdx = (int)aeAffiliation; int nSymbolIdx = (int)aeSymbol; ! if (meSymbology == NTDS) ! { return maSymbolA[nAffilIdx][nSymbolIdx]; } *************** *** 1182,1187 **** } ! /***********************************************************************************/ ! int tcTacticalMapView::DrawSymbol2(Graphics *apGraphics, MapView::tcMapObj *pMO) { float symbsize=15.0f; float vectsize=18.0f; // heading vector length --- 1244,1252 ---- } ! /** ! * Version that uses pre-drawn images to draw symbols ! */ ! int tcTacticalMapView::DrawSymbol2(Graphics *graphics, MapView::tcMapObj *pMO) ! { float symbsize=15.0f; float vectsize=18.0f; // heading vector length *************** *** 1207,1223 **** } ! if (apGraphics==NULL) ShowAndAbort("tcTacticalMapView::DrawSymbol failed to get Graphics object\n"); ! apGraphics->GetClipBounds(&rclipbounds); ! if (type == SYMBOL_SENSOR) { symbsize = 8.0f; vectsize = 10.0f; } ! else if (type == SYMBOL_TARGET) { symbsize = 30.0f; } unsigned int mnPenColor; ! switch (pMO->meAffiliation) { case UNKNOWN: mnPenColor = 0xFFFFFF5F; --- 1272,1291 ---- } ! if (graphics==NULL) ShowAndAbort("tcTacticalMapView::DrawSymbol failed to get Graphics object\n"); ! graphics->GetClipBounds(&rclipbounds); ! if (type == SYMBOL_SENSOR) ! { symbsize = 8.0f; vectsize = 10.0f; } ! else if (type == SYMBOL_TARGET) ! { symbsize = 30.0f; } unsigned int mnPenColor; ! switch (pMO->meAffiliation) ! { case UNKNOWN: mnPenColor = 0xFFFFFF5F; *************** *** 1236,1243 **** break; } ! if (type == SYMBOL_TARGET) { mnPenColor = 0xFFFF0000; } ! if (bBearingOnly) { // use faded (half alpha) color for bearing line tracks // symbol is drawn ahead of time so its color remains the same --- 1304,1313 ---- break; } ! if (type == SYMBOL_TARGET) ! { mnPenColor = 0xFFFF0000; } ! if (bBearingOnly) ! { // use faded (half alpha) color for bearing line tracks // symbol is drawn ahead of time so its color remains the same *************** *** 1259,1263 **** // yet ANOTHER exception to the rule, this needs to be cleaned up!! float xv_passive, yv_passive; ! if (bBearingOnly) { h = atan2f(sinf(h),cosf(h)*cosf(pMO->mfLat)); float dx = passive_vect_size*sinf(h); --- 1329,1334 ---- // yet ANOTHER exception to the rule, this needs to be cleaned up!! float xv_passive, yv_passive; ! if (bBearingOnly) ! { h = atan2f(sinf(h),cosf(h)*cosf(pMO->mfLat)); float dx = passive_vect_size*sinf(h); *************** *** 1283,1287 **** } RectF rect(x-2.0f,y-2.0f,4.0f,4.0f); ! apGraphics->DrawPie(mpPen,rect,0,360); return 0; } --- 1354,1358 ---- } RectF rect(x-2.0f,y-2.0f,4.0f,4.0f); ! graphics->DrawPie(mpPen,rect,0,360); return 0; } *************** *** 1298,1305 **** if (type == SYMBOL_TARGET) { ! apGraphics->DrawLine(mpPen,x,y-8,x,p1y); ! apGraphics->DrawLine(mpPen,x,y+8,x,p2y); ! apGraphics->DrawLine(mpPen,x-8,y,p1x,y); ! apGraphics->DrawLine(mpPen,x+8,y,p2x,y); h = HEADING_UNKNOWN; } --- 1369,1376 ---- if (type == SYMBOL_TARGET) { ! graphics->DrawLine(mpPen,x,y-8,x,p1y); ! graphics->DrawLine(mpPen,x,y+8,x,p2y); ! graphics->DrawLine(mpPen,x-8,y,p1x,y); ! graphics->DrawLine(mpPen,x+8,y,p2x,y); h = HEADING_UNKNOWN; } *************** *** 1312,1325 **** mpPen->SetColor(pMO->mnColor); if (mpOptions->mbFillRangeCircles) { ! apGraphics->FillPie(mpBrush,pscreen.x-0.5f*width,pscreen.y-0.5f*height, width,height,h-0.5f*pMO->mfArc_deg-90.0f,pMO->mfArc_deg); // h is in degrees (fix this) } else { if (pMO->mfArc_deg >= 360.0f) { ! apGraphics->DrawEllipse(mpPen,pscreen.x-0.5f*width,pscreen.y-0.5f*height, width,height); } else { ! apGraphics->DrawPie(mpPen,pscreen.x-0.5f*width,pscreen.y-0.5f*height, width,height,h-0.5f*pMO->mfArc_deg-90.0f,pMO->mfArc_deg); // h is in degrees (fix this) } --- 1383,1396 ---- mpPen->SetColor(pMO->mnColor); if (mpOptions->mbFillRangeCircles) { ! graphics->FillPie(mpBrush,pscreen.x-0.5f*width,pscreen.y-0.5f*height, width,height,h-0.5f*pMO->mfArc_deg-90.0f,pMO->mfArc_deg); // h is in degrees (fix this) } else { if (pMO->mfArc_deg >= 360.0f) { ! graphics->DrawEllipse(mpPen,pscreen.x-0.5f*width,pscreen.y-0.5f*height, width,height); } else { ! graphics->DrawPie(mpPen,pscreen.x-0.5f*width,pscreen.y-0.5f*height, width,height,h-0.5f*pMO->mfArc_deg-90.0f,pMO->mfArc_deg); // h is in degrees (fix this) } *************** *** 1328,1332 **** else { Image *pSymbol = GetSymbol(pMO->meAffiliation, pMO->meSymbol); ! apGraphics->DrawImage(pSymbol, x + mfSymbolXOffset, y + mfSymbolYOffset); } --- 1399,1403 ---- else { Image *pSymbol = GetSymbol(pMO->meAffiliation, pMO->meSymbol); ! graphics->DrawImage(pSymbol, x + mfSymbolXOffset, y + mfSymbolYOffset); } *************** *** 1334,1365 **** // draw heading vector (unless == HEADING_UNKNOWN) if (bHeadingValid && (!bBearingOnly)) { ! apGraphics->DrawLine(mpPen,x,y,xv,yv); } ! if ((mbShowTrackID)&&(pMO->mnID!=NULL_INDEX)&&(type != SYMBOL_UNKNOWN)) { char zBuff[16]; mpBrush->SetColor(0xFEFFFFFF); sprintf(zBuff,"%04d",pMO->mnID); ! DrawText(apGraphics,mpFontSmall,mpBrush,zBuff,x-9.0f,y+15.0f); } // draw focus box if applicable ! if ((pMO->mbFocus)&&(pMO->mnID!=NULL_INDEX)) { mpPen->SetColor(Color(0xFFFFFFFF)); const float fFocus = 6.5f; ! apGraphics->DrawLine(mpPen,p1x,p1y-fFocus,p1x-fFocus,p1y-fFocus); ! apGraphics->DrawLine(mpPen,p1x-fFocus,p1y-fFocus,p1x-fFocus,p1y); ! apGraphics->DrawLine(mpPen,p1x-fFocus,p2y,p1x-fFocus,p2y+fFocus); ! apGraphics->DrawLine(mpPen,p1x-fFocus,p2y+fFocus,p1x,p2y+fFocus); ! apGraphics->DrawLine(mpPen,p2x,p2y+fFocus,p2x+fFocus,p2y+fFocus); ! apGraphics->DrawLine(mpPen,p2x+fFocus,p2y+fFocus,p2x+fFocus,p2y); ! apGraphics->DrawLine(mpPen,p2x+fFocus,p1y,p2x+fFocus,p1y-fFocus); ! apGraphics->DrawLine(mpPen,p2x+fFocus,p1y-fFocus,p2x,p1y-fFocus); } // draw bearing line if applicable ! if (bBearingOnly) { ! apGraphics->DrawLine(mpPen,xv,yv,xv_passive,yv_passive); } --- 1405,1439 ---- // draw heading vector (unless == HEADING_UNKNOWN) if (bHeadingValid && (!bBearingOnly)) { ! graphics->DrawLine(mpPen,x,y,xv,yv); } ! if ((mbShowTrackID)&&(pMO->mnID!=NULL_INDEX)&&(type != SYMBOL_UNKNOWN)) ! { char zBuff[16]; mpBrush->SetColor(0xFEFFFFFF); sprintf(zBuff,"%04d",pMO->mnID); ! DrawText(graphics,mpFontSmall,mpBrush,zBuff,x-9.0f,y+15.0f); } // draw focus box if applicable ! if ((pMO->mbFocus)&&(pMO->mnID!=NULL_INDEX)) ! { mpPen->SetColor(Color(0xFFFFFFFF)); const float fFocus = 6.5f; ! graphics->DrawLine(mpPen,p1x,p1y-fFocus,p1x-fFocus,p1y-fFocus); ! graphics->DrawLine(mpPen,p1x-fFocus,p1y-fFocus,p1x-fFocus,p1y); ! graphics->DrawLine(mpPen,p1x-fFocus,p2y,p1x-fFocus,p2y+fFocus); ! graphics->DrawLine(mpPen,p1x-fFocus,p2y+fFocus,p1x,p2y+fFocus); ! graphics->DrawLine(mpPen,p2x,p2y+fFocus,p2x+fFocus,p2y+fFocus); ! graphics->DrawLine(mpPen,p2x+fFocus,p2y+fFocus,p2x+fFocus,p2y); ! graphics->DrawLine(mpPen,p2x+fFocus,p1y,p2x+fFocus,p1y-fFocus); ! graphics->DrawLine(mpPen,p2x+fFocus,p1y-fFocus,p2x,p1y-fFocus); } // draw bearing line if applicable ! if (bBearingOnly) ! { ! graphics->DrawLine(mpPen,xv,yv,xv_passive,yv_passive); } Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcGameView.cpp 21 Jun 2004 22:22:00 -0000 1.10 --- tcGameView.cpp 19 Jul 2004 00:53:01 -0000 1.11 *************** *** 565,569 **** unsigned int nColor; ! switch (aeAffiliation) { case UNKNOWN: nColor = 0xFFFFFF7F; --- 565,570 ---- unsigned int nColor; ! switch (aeAffiliation) ! { case UNKNOWN: nColor = 0xFFFFFF7F; *************** *** 582,586 **** // loop through all game objects and display those matching anAlliance ! while (i++<nSize) { mpSS->maPlatformState.GetNextAssoc(poolpos,nKey,po); point.x = (float)po->mcKin.mfLon_rad; --- 583,588 ---- // loop through all game objects and display those matching anAlliance ! while (i++<nSize) ! { mpSS->maPlatformState.GetNextAssoc(poolpos,nKey,po); point.x = (float)po->mcKin.mfLon_rad; *************** *** 593,603 **** mpMapView->maMapObj[rnIndex].mbExists = 1; mpMapView->maMapObj[rnIndex].mbFocus = 0; ! mpMapView->maMapObj[rnIndex].mfHeading = po->mcKin.mfHeading_rad; ! mpMapView->maMapObj[rnIndex].mnFlags = TRACK_HEADING_VALID; ! mpMapView->maMapObj[rnIndex].meSymbol = GetMapSymbolByClassification(pdata->mnType); ! mpMapView->maMapObj[rnIndex].meAffiliation = aeAffiliation; ! mpMapView->maMapObj[rnIndex].mfLon = (float)po->mcKin.mfLon_rad; ! mpMapView->maMapObj[rnIndex].mfLat = (float)po->mcKin.mfLat_rad; ! mpMapView->maMapObj[rnIndex].mnID = po->mnID; rnIndex++; } --- 595,614 ---- mpMapView->maMapObj[rnIndex].mbExists = 1; mpMapView->maMapObj[rnIndex].mbFocus = 0; ! mpMapView->maMapObj[rnIndex].meSymbol = GetMapSymbolByClassification(pdata->mnType); ! mpMapView->maMapObj[rnIndex].meAffiliation = aeAffiliation; ! mpMapView->maMapObj[rnIndex].mfLon = (float)po->mcKin.mfLon_rad; ! mpMapView->maMapObj[rnIndex].mfLat = (float)po->mcKin.mfLat_rad; ! mpMapView->maMapObj[rnIndex].mnID = po->mnID; ! ! if (mpMapView->maMapObj[rnIndex].meSymbol != SYMBOL_FIXED) ! { ! mpMapView->maMapObj[rnIndex].mfHeading = po->mcKin.mfHeading_rad; ! mpMapView->maMapObj[rnIndex].mnFlags = TRACK_HEADING_VALID; ! } ! else ! { ! mpMapView->maMapObj[rnIndex].mnFlags = 0; ! } ! rnIndex++; } *************** *** 619,624 **** } ! /******************************************************************************/ ! // add mnAlliance's sensor data to view void tcGameView::AddSensorTracks(unsigned int anAlliance, int& rnIndex, int& rnWorldIdx, double afStatusTime) --- 630,637 ---- } ! ! /** ! * add mnAlliance's sensor data to view ! */ void tcGameView::AddSensorTracks(unsigned int anAlliance, int& rnIndex, int& rnWorldIdx, double afStatusTime) *************** *** 657,662 **** mpMapView->maMapObj[rnIndex].meSymbol = GetMapSymbolByClassification(track.mnClassification); - //mpMapView->maMapObj[rnIndex].meSymbol = (teSymbol)pTrack->mnClassification; teAffiliation affil = GetMapSymbolAffiliation(track.mnAffiliation); --- 670,679 ---- mpMapView->maMapObj[rnIndex].meSymbol = GetMapSymbolByClassification(track.mnClassification); + // don't show heading for tracks with zero speed (e.g. fixed ground) + if (track.mfSpeed_kts == 0) + { + mpMapView->maMapObj[rnIndex].mnFlags &= ~TRACK_HEADING_VALID; + } teAffiliation affil = GetMapSymbolAffiliation(track.mnAffiliation); *************** *** 697,711 **** } - - /* - tcGameObject *ptemp; - tnPoolIndex nTrackKey = track.mnID; - if (mpSS->maPlatformState.Lookup(nTrackKey, ptemp)) { - mpMapView->maMapObj[rnIndex].mnID = nTrackKey; - } - else { - mpMapView->maMapObj[rnIndex].mnID = NULL_INDEX; - } - */ rnIndex++; } --- 714,717 ---- Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcPlatformObject.cpp 18 Jul 2004 03:18:01 -0000 1.26 --- tcPlatformObject.cpp 19 Jul 2004 00:53:01 -0000 1.27 *************** *** 52,58 **** } ! void tcPlatformObject::DesignateLauncherDatum(tcPoint p, unsigned int anLauncher) { ! mcLauncherState.SetLauncherDatum(anLauncher, p.x, p.y); } --- 52,58 ---- } ! void tcPlatformObject::DesignateLauncherDatum(tsGeoPoint p, unsigned int anLauncher) { ! mcLauncherState.SetLauncherDatum(anLauncher, p.mfLon_rad, p.mfLat_rad, p.mfAlt_m); } *************** *** 271,274 **** --- 271,283 ---- } + + /** + * @return pointer to launcher with index of <idx> or NULL (0) for error + */ + tcLauncher* tcPlatformObject::GetLauncher(unsigned idx) + { + return mcLauncherState.GetLauncher(idx); + } + /** * Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcRadar.cpp 29 May 2004 00:11:54 -0000 1.8 --- tcRadar.cpp 19 Jul 2004 00:53:01 -0000 1.9 *************** *** 25,28 **** --- 25,30 ---- #include "tcAirObject.h" #include "tcMissileObject.h" + #include "tcAirfieldObject.h" + #include "tcGenericDBObject.h" #include "tcMissileDBObject.h" *************** *** 116,120 **** --- 118,124 ---- bool isSurface = false; bool isAir = false; + bool isGround = false; float rcs_dBsm; + if (const tcSurfaceObject* surfaceObj = dynamic_cast<const tcSurfaceObject*>(target)) { *************** *** 132,135 **** --- 136,144 ---- isAir = true; } + else if (const tcAirfieldObject* fieldObj = dynamic_cast<const tcAirfieldObject*>(target)) + { + rcs_dBsm = fieldObj->mpDBObject->mfRcs_dbsm; + isGround = true; + } else { *************** *** 166,170 **** bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || ! (mpDBObj->mbDetectsSurface && isSurface); bool bDetectable; --- 175,180 ---- bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || ! (mpDBObj->mbDetectsSurface && isSurface) || ! (mpDBObj->mbDetectsGround && isGround); bool bDetectable; |