[Gcblue-commits] gcb_wx/src/sim tcMissileObject.cpp,1.13,1.14 tcSimState.cpp,1.46,1.47 tcWeaponObjec
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-07-23 00:45:56
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3451/src/sim Modified Files: tcMissileObject.cpp tcSimState.cpp tcWeaponObject.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tcSimState.cpp 19 Jul 2004 00:53:01 -0000 1.46 --- tcSimState.cpp 23 Jul 2004 00:45:47 -0000 1.47 *************** *** 390,393 **** --- 390,395 ---- wxASSERT(missile); + + #if 0 float terrainHeight_m = missile->mcTerrain.mfHeight_m; if (missile->mcKin.mfAlt_m > terrainHeight_m + 25.0) return; *************** *** 396,399 **** --- 398,402 ---- double lon_rad; double lat_rad; + float tImpact = missile->mcKin.CalculateGroundImpactPoint( terrainHeight_m + blastHeight_m, lon_rad, lat_rad); *************** *** 404,408 **** missile->mcKin.mfLon_rad = lon_rad; missile->mcKin.mfLat_rad = lat_rad; ! --- 407,412 ---- missile->mcKin.mfLon_rad = lon_rad; missile->mcKin.mfLat_rad = lat_rad; ! #endif ! if (!missile->IsDetonated()) return; *************** *** 413,420 **** 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; --- 417,424 ---- tcRect blastRegion; ! float west = missile->mcKin.mfLon_rad - rLon; ! float east = missile->mcKin.mfLon_rad + rLon; ! float north = missile->mcKin.mfLat_rad + rLat; ! float south = missile->mcKin.mfLat_rad - rLat; if (west < -C_PI) west += C_TWOPI; if (east >= C_PI) east -= C_TWOPI; *************** *** 451,454 **** --- 455,466 ---- } } + else + { + tcString s; + s.Format("weapon (DUD) %d target %d, range: %3.1f m, time %.1f s", + missile->mnID, target->mnID, range_m, mfSimTime); + WTL(s.GetBuffer()); + } + } else *************** *** 526,529 **** --- 538,542 ---- return afDamage / pPlatformObj->mpDBObject->mfToughness; } + wxASSERT(false); return afDamage; } Index: tcWeaponObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcWeaponObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcWeaponObject.cpp 1 May 2004 21:49:06 -0000 1.4 --- tcWeaponObject.cpp 23 Jul 2004 00:45:47 -0000 1.5 *************** *** 52,55 **** --- 52,71 ---- } + /** + * Called when weapon detonates + */ + void tcWeaponObject::Detonate() + { + fuseHasTriggered = true; + } + + /** + * @return true if weapon has detonated + */ + bool tcWeaponObject::IsDetonated() + { + return fuseHasTriggered; + } + bool tcWeaponObject::IsIntendedTarget(long id) { *************** *** 80,85 **** */ tcWeaponObject::tcWeaponObject() { ! intendedTarget = -1; } --- 96,102 ---- */ tcWeaponObject::tcWeaponObject() + : fuseHasTriggered(false),intendedTarget(-1) { ! } *************** *** 96,100 **** */ tcWeaponObject::tcWeaponObject(tcDatabaseObject *obj) ! : tcGameObject(obj) { wxASSERT(simState); --- 113,117 ---- */ tcWeaponObject::tcWeaponObject(tcDatabaseObject *obj) ! : tcGameObject(obj), fuseHasTriggered(false) { wxASSERT(simState); Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcMissileObject.cpp 19 Jul 2004 00:53:01 -0000 1.13 --- tcMissileObject.cpp 23 Jul 2004 00:45:47 -0000 1.14 *************** *** 273,278 **** if (pSegmentInfo->meAltitudeMode == AM_DATUM) { ! interceptPitch_rad = atanf(0.001f*(msWaypoint.mfAlt_m - mcKin.mfAlt_m)/ ! mfRangeToObjective_km); useInterceptPitch = true; } --- 273,300 ---- if (pSegmentInfo->meAltitudeMode == AM_DATUM) { ! tcTrack groundTrack; ! ! groundTrack.mfAlt_m = msWaypoint.mfAlt_m; ! groundTrack.mfLon_rad = msWaypoint.mfLon_rad; ! groundTrack.mfLat_rad = msWaypoint.mfLat_rad; ! groundTrack.mfSpeed_kts = 0; ! ! float tti_s; ! float range_rad; ! ! mcKin.GetInterceptData3D(groundTrack, mfGoalHeading_rad, ! interceptPitch_rad, tti_s, range_rad); ! ! mfRangeToObjective_km = C_RADTOKM * range_rad; ! ! if (mfRangeToObjective_km <= 0.050) ! { ! Detonate(); ! } ! ! mfInterceptTime = tti_s; ! ! //interceptPitch_rad = atanf(0.001f*(msWaypoint.mfAlt_m - mcKin.mfAlt_m)/ ! // mfRangeToObjective_km); useInterceptPitch = true; } *************** *** 295,309 **** mfRangeToObjective_km *= C_RADTOKM; // convert to km - if (tti_s <= 5.0f) - { - mfGuidanceUpdateInterval = 0.2f; - mcSensorState.mfCurrentScanPeriod_s = 0.2f; - } - else if (tti_s <= 2.0f) - { - mfGuidanceUpdateInterval = 0.1f; - mcSensorState.mfCurrentScanPeriod_s = 0.1f; - } - if (msKState.mfAltitude_m <= 4.0) --- 317,320 ---- *************** *** 331,341 **** } //************ update altitude control ************** switch (pSegmentInfo->meAltitudeMode) { case AM_ASL: - case AM_AGL: fGoalAltitude_m = pSegmentInfo->mfAltitude_m; break; case AM_INTERCEPT: // use seeker data or maintain altitude break; --- 342,368 ---- } + // update guidance update rate and seeker scan rate based on time to intercept + if (mfInterceptTime <= 5.0) + { + mfGuidanceUpdateInterval = 0.2f; + mcSensorState.mfCurrentScanPeriod_s = 0.2f; + } + else if (mfInterceptTime <= 2.0) + { + mfGuidanceUpdateInterval = 0.1f; + mcSensorState.mfCurrentScanPeriod_s = 0.1f; + } + + //************ update altitude control ************** switch (pSegmentInfo->meAltitudeMode) { case AM_ASL: fGoalAltitude_m = pSegmentInfo->mfAltitude_m; break; + case AM_AGL: + fGoalAltitude_m = pSegmentInfo->mfAltitude_m + + mcTerrain.mfHeight_m; + break; case AM_INTERCEPT: // use seeker data or maintain altitude break; *************** *** 402,405 **** --- 429,433 ---- mfGuidanceUpdateInterval = 1.0f; // 1 second default mfLastGuidanceUpdate = 0.0f; + mfInterceptTime = 9999.0f; } *************** *** 541,545 **** // tsMissileKState for detailed missile modeling using tcAero memset(&msKState,0x00,sizeof(msKState)); ! mfLastGuidanceUpdate = 0; guidanceStatusTime = 0; mfGuidanceUpdateInterval = 0.5f; --- 569,573 ---- // tsMissileKState for detailed missile modeling using tcAero memset(&msKState,0x00,sizeof(msKState)); ! guidanceStatusTime = 0; mfGuidanceUpdateInterval = 0.5f; *************** *** 580,583 **** --- 608,612 ---- mfLastGuidanceUpdate = 0.0f; guidanceStatusTime = 0; + mfInterceptTime = 9999.0f; // if these inits are missing, causes a crash with time accel after missile launch *************** *** 589,594 **** // 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); } --- 618,627 ---- // init sensors, only one sensor (primary) supported in this version tnPoolIndex nSensorKey = database->GetKey(obj->maSensorClass[0]); ! ! if (nSensorKey != -1) ! { ! mcSensorState.InitFromDB(database,nSensorKey, 0); // missile seeker always points forward ! mcSensorState.SetParent(this); ! } } |