[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.139,1.140 tcAeroAirObject.cpp,1.19,1.20 tcAirObject.cpp,1
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:47:47
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1255/src/sim Modified Files: Game.cpp tcAeroAirObject.cpp tcAirObject.cpp tcBallisticWeapon.cpp tcFlightPort.cpp tcHeloObject.cpp tcLauncher.cpp tcLauncherState.cpp tcObjectControl.cpp tcRadar.cpp tcSensorMap.cpp tcSensorPlatform.cpp tcSimState.cpp Log Message: GCB 0.8.0 release Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** tcSimState.cpp 26 Jul 2005 00:37:05 -0000 1.88 --- tcSimState.cpp 10 Sep 2005 21:47:38 -0000 1.89 *************** *** 418,421 **** --- 418,422 ---- if (trueRange2 < 144.0f) // 12.0 m range { + bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; float fDamage = missile->mpDBObject->mfDamage; float damageFraction = GetFractionalDamage(fDamage, target); *************** *** 431,444 **** if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! ReportDamage(target); } else if (missile->IsOwnAlliance()) { - tcSound::Get()->PlayEffect("Explosion2"); - wxString msg = wxString::Format("Missile (%s) hit Track %d\n", missile->mzClass.mz, target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); } } --- 432,444 ---- if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! if (!alreadyDestroyed) ReportDamage(target); } else if (missile->IsOwnAlliance()) { wxString msg = wxString::Format("Missile (%s) hit Track %d\n", missile->mzClass.mz, target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); } + PlayEntitySoundEffect(missile, "Explosion2"); } *************** *** 475,478 **** --- 475,479 ---- if (trueRange2 < 144.0f) // 12.0 m range, dz not counted as heavily { + bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; float fDamage = torp->mpDBObject->mfDamage; float damageFraction = GetFractionalDamage(fDamage, target); *************** *** 487,491 **** if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! ReportDamage(target); } else if (torp->IsOwnAlliance()) --- 488,492 ---- if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! if (!alreadyDestroyed) ReportDamage(target); } else if (torp->IsOwnAlliance()) *************** *** 494,500 **** target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); - - tcSound::Get()->PlayEffect("Explosion2"); } } --- 495,500 ---- target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); } + PlayEntitySoundEffect(torp, "Explosion2"); } *************** *** 567,574 **** { float range_m = 1000.0f * target->mcKin.RangeToKmAlt(weapon->mcKin); ! float damage_range_m = 0.5f * target->GetSpan() + 25.0f; if (range_m <= damage_range_m) { float damageFraction = GetFractionalDamage(fDamage, target); target->mfDamageLevel += damageFraction; --- 567,575 ---- { float range_m = 1000.0f * target->mcKin.RangeToKmAlt(weapon->mcKin); ! float damage_range_m = 0.6f * target->GetSpan(); if (range_m <= damage_range_m) { float damageFraction = GetFractionalDamage(fDamage, target); + bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; target->mfDamageLevel += damageFraction; *************** *** 586,590 **** if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! ReportDamage(target); } else if (weapon->IsOwnAlliance()) --- 587,591 ---- if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! if (!alreadyDestroyed) ReportDamage(target); } else if (weapon->IsOwnAlliance()) *************** *** 593,599 **** target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); - - tcSound::Get()->PlayEffect("Explosion2"); } } else --- 594,599 ---- target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); } + PlayEntitySoundEffect(weapon, "Explosion2"); } else *************** *** 648,651 **** --- 648,652 ---- if (randf() < 0.3f) damageFraction = 0; // additional miss chance + bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; target->mfDamageLevel += damageFraction; weapon->mfDamageLevel += 1.0f; // destroys itself on impact *************** *** 657,666 **** if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! ReportDamage(target); ! } ! else ! { ! tcSound::Get()->PlayEffect("Explosion2"); } } } --- 658,665 ---- if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! if (!alreadyDestroyed) ReportDamage(target); } + + PlayEntitySoundEffect(weapon, "Explosion2"); } } *************** *** 767,771 **** tnPoolIndex nKey; tcKinematics *pKin; ! tcTerrainInfo *pTerrainInfo; for (tnPoolIndex i=0;i<nSize;i++) --- 766,773 ---- tnPoolIndex nKey; tcKinematics *pKin; ! tcTerrainInfo *terrainInfo; ! ! const updateDistance_rad = 20.0 * C_MTORAD; ! const lookAheadUpdateSpeed_kts = 200.0f; // speed threshold for updating lookAheadHeight_m for (tnPoolIndex i=0;i<nSize;i++) *************** *** 773,785 **** maPlatformState.GetNextAssoc(cmappos,nKey,pobj); pKin = &pobj->mcKin; ! pTerrainInfo = &pobj->mcTerrain; ! if ((fabs(pKin->mfLat_rad - pTerrainInfo->mfLatDatum) > 1.6e-6f)|| ! (fabs(pKin->mfLon_rad - pTerrainInfo->mfLonDatum) > 1.6e-6f)) { // about 10 meters ! pobj->mcTerrain.mfHeight_m = mpMapData->GetTerrainHeight(C_180OVERPI*(float)pKin->mfLon_rad, C_180OVERPI*(float)pKin->mfLat_rad,mfSimTime); ! pTerrainInfo->mfLonDatum = (float)pKin->mfLon_rad; ! pTerrainInfo->mfLatDatum = (float)pKin->mfLat_rad; } } --- 775,800 ---- maPlatformState.GetNextAssoc(cmappos,nKey,pobj); pKin = &pobj->mcKin; ! terrainInfo = &pobj->mcTerrain; ! if ((fabs(pKin->mfLat_rad - terrainInfo->mfLatDatum) > updateDistance_rad)|| ! (fabs(pKin->mfLon_rad - terrainInfo->mfLonDatum) > updateDistance_rad)) { // about 10 meters ! terrainInfo->mfHeight_m = mpMapData->GetTerrainHeight(C_180OVERPI*(float)pKin->mfLon_rad, C_180OVERPI*(float)pKin->mfLat_rad,mfSimTime); ! terrainInfo->mfLonDatum = (float)pKin->mfLon_rad; ! terrainInfo->mfLatDatum = (float)pKin->mfLat_rad; ! ! if (pobj->mcKin.mfSpeed_kts > lookAheadUpdateSpeed_kts) ! { ! double lon_rad, lat_rad; ! float alt_m; ! pKin->PredictPosition(3.0f, lon_rad, lat_rad, alt_m); ! terrainInfo->lookAheadHeight_m = mpMapData->GetTerrainHeight(C_180OVERPI * (float)lon_rad, ! C_180OVERPI * (float)lat_rad, mfSimTime); ! } ! else ! { ! terrainInfo->lookAheadHeight_m = terrainInfo->mfHeight_m; ! } } } *************** *** 1859,1862 **** --- 1874,1880 ---- void tcSimState::RandInit() { + wxASSERT(false); + return; // disabled for now + int nPlatforms = 12; // number of platforms to add *************** *** 1927,1935 **** tcGeoRect theater; mpMapData->GetTheaterArea(theater); ! float dlon = fabsf(theater.GetLeft() + 8.0); ! float dlat = fabsf(theater.GetTop() - 55.0); if ((dlon > 0.1) || (dlat > 0.1)) { ! mpMapData->LoadHighResB(-8.0, 55.0); } --- 1945,1957 ---- tcGeoRect theater; mpMapData->GetTheaterArea(theater); ! ! const float rand_lon = 119.0; ! const float rand_lat = 26.0; ! ! float dlon = fabsf(theater.GetLeft() - rand_lon); ! float dlat = fabsf(theater.GetTop() - rand_lat); if ((dlon > 0.1) || (dlat > 0.1)) { ! mpMapData->LoadHighResB(rand_lon, rand_lat); } *************** *** 2447,2450 **** --- 2469,2474 ---- track.mnID = obj->mnID; track.mnAffiliation = FRIENDLY; + track.mfTimestamp = obj->mfStatusTime; + track.SetAllValid(); return true; Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcSensorMap.cpp 1 Jun 2005 00:13:33 -0000 1.22 --- tcSensorMap.cpp 10 Sep 2005 21:47:38 -0000 1.23 *************** *** 546,550 **** { tcAllianceSensorMap *pMap = GetMap(anAlliance); ! return pMap->GetSensorMapTrack(anTrackID); } --- 546,557 ---- { tcAllianceSensorMap *pMap = GetMap(anAlliance); ! if (pMap != 0) ! { ! return pMap->GetSensorMapTrack(anTrackID); ! } ! else ! { ! return 0; ! } } Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcFlightPort.cpp 20 Jul 2005 16:24:54 -0000 1.22 --- tcFlightPort.cpp 10 Sep 2005 21:47:38 -0000 1.23 *************** *** 433,437 **** airstate->obj->mnID = localId++; // assign local id airstate->op = OP_NONE; ! airstate->ready_time = 0; airstate->current_location = loc; airstate->current_spot = emptySpotIdx; --- 433,437 ---- airstate->obj->mnID = localId++; // assign local id airstate->op = OP_NONE; ! airstate->ready_time = last_update_time; airstate->current_location = loc; airstate->current_spot = emptySpotIdx; *************** *** 654,657 **** --- 654,662 ---- } + if (spot->obj_info->ready_time > last_update_time) + { + return 0; // not ready yet + } + MoveToLaunchQueue(airstate); *************** *** 677,684 **** tsSpotInfo *spot = &launch_spots.at(n); if ((spot->obj_info != 0) && (spot->obj_info->obj != 0) && ! (spot->obj_info->obj->mnID == id)) { ! Launch((int)n); ! return 1; } } --- 682,697 ---- tsSpotInfo *spot = &launch_spots.at(n); if ((spot->obj_info != 0) && (spot->obj_info->obj != 0) && ! (spot->obj_info->obj->mnID == id)) { ! bool isReady = (spot->obj_info->ready_time >= last_update_time); ! if (isReady) ! { ! Launch((int)n); ! return 1; ! } ! else ! { ! return 0; ! } } } Index: tcHeloObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcHeloObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcHeloObject.cpp 20 Jul 2005 16:24:54 -0000 1.6 --- tcHeloObject.cpp 10 Sep 2005 21:47:38 -0000 1.7 *************** *** 100,104 **** mcKin.mfClimbAngle_rad = 0; ! if ((dalt_m > -0.25f)&&(dalt_m < 0.25f)) { return; --- 100,104 ---- mcKin.mfClimbAngle_rad = 0; ! if ((dalt_m > -0.25f)&&(dalt_m < 0.25f)&&(fuel_kg > 0)) { return; *************** *** 130,135 **** // restrict climb to altitude rate ! dalt_max = fAltitudeRate_mps * dt_s; ! dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} --- 130,135 ---- // restrict climb to altitude rate ! dalt_max = (fuel_kg > 0) ? fAltitudeRate_mps * dt_s : -0.5f * fAltitudeRate_mps * dt_s; ! dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} *************** *** 167,171 **** { if (mcKin.mfSpeed_kts > 0) mcKin.mfSpeed_kts -= 2*ds_max; ! if (mcKin.mfAlt_m > 0) mcKin.mfAlt_m -= dt_s * 10; } } --- 167,171 ---- { if (mcKin.mfSpeed_kts > 0) mcKin.mfSpeed_kts -= 2*ds_max; ! //if (mcKin.mfAlt_m > 0) mcKin.mfAlt_m -= dt_s * 10; } } Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcLauncher.cpp 26 Jul 2005 00:37:05 -0000 1.28 --- tcLauncher.cpp 10 Sep 2005 21:47:38 -0000 1.29 *************** *** 368,372 **** float fcFov = C_PIOVER180 * fireControlSensor->mpDBObj->mfFieldOfView_deg; ! if ((meLaunchMode == SEEKER_TRACK) & (!IsAutoPoint())) { if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(mpChildDBObj)) --- 368,372 ---- float fcFov = C_PIOVER180 * fireControlSensor->mpDBObj->mfFieldOfView_deg; ! if ((meLaunchMode == SEEKER_TRACK) && (!IsAutoPoint())) { if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(mpChildDBObj)) *************** *** 436,440 **** return true; } ! else if ((targetClassification & PTYPE_SUBMARINE)&&(mnTargetFlags & SUBSURFACE_TARGET)) { return true; --- 436,440 ---- return true; } ! else if ((targetClassification == PTYPE_SUBMARINE)&&(mnTargetFlags & SUBSURFACE_TARGET)) { return true; *************** *** 461,464 **** --- 461,465 ---- mnChildDBKey = -1; mpChildDBObj = 0; + mnCurrent = 0; return; } *************** *** 578,581 **** --- 579,593 ---- } + void tcLauncher::SetDatum(double lon_rad, double lat_rad, float alt_m) + { + msDatum.Set(lon_rad, lat_rad, alt_m); + + // update run to enable for torpedo + if (tcTorpedoDBObject* torpedoData = dynamic_cast<tcTorpedoDBObject*>(mpChildDBObj)) + { + runToEnable_m = 500.0f * parent->mcKin.RangeToKm(lon_rad, lat_rad); + } + } + /** * Added so that appropriate commandObj receives new command for multiplayer *************** *** 753,757 **** // needs a fire control track (launching platform) to launch ! if ((meLaunchMode == FC_TRACK)||(meLaunchMode == SEEKER_TRACK)) { if (!fireControlSensor) --- 765,769 ---- // needs a fire control track (launching platform) to launch ! if (meLaunchMode == FC_TRACK) { if (!fireControlSensor) *************** *** 797,800 **** --- 809,843 ---- return; } + + /* check fire control state if necessary (this should be able to be handled without + ** all of this sprawling code) */ + if (pMissileDBObj->NeedsFireControl()) + { + if (!fireControlSensor) + { + status = NO_FIRECONTROL; // database error + return; + } + + if (!fireControlSensor->IsTrackAvailable()) + { + status = FC_BUSY; // no FC tracks available + return; + } + + if (targetObj == 0) + { + status = NOT_DETECTED_FC; // target doesn't exist + return; + } + + float range; + if (!fireControlSensor->CanDetectTarget(targetObj, range)) + { + status = NOT_DETECTED_FC; + return; + } + } + long nSensorKey = pMissileDBObj->GetSensorKey(); Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tcObjectControl.cpp 26 Jul 2005 00:37:05 -0000 1.46 --- tcObjectControl.cpp 10 Sep 2005 21:47:38 -0000 1.47 *************** *** 113,119 **** tcOrder order; ! double priority = brain->GetTaskPriority(taskList[n]); ! sprintf(zBuff, "%s %.0f", taskList[n].c_str(), priority); context->DrawTextR(zBuff, textx, texty, font, color, fontSize, LEFT_BASE_LINE); --- 113,123 ---- tcOrder order; ! #ifdef _DEBUG ! double priority = brain->GetTaskPriority(taskList[n]); sprintf(zBuff, "%s %.0f", taskList[n].c_str(), priority); + #else + sprintf(zBuff, "%s", taskList[n].c_str()); // don't draw priority in release mode + #endif + context->DrawTextR(zBuff, textx, texty, font, color, fontSize, LEFT_BASE_LINE); *************** *** 867,871 **** // place next to altitude bar float x = 70.0f; ! float y = 80.0f; osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); DrawTextR("Gear down", x, y, defaultFont.get(), --- 871,875 ---- // place next to altitude bar float x = 70.0f; ! float y = 100.0f; osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); DrawTextR("Gear down", x, y, defaultFont.get(), Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcAirObject.cpp 14 Jul 2005 23:42:23 -0000 1.27 --- tcAirObject.cpp 10 Sep 2005 21:47:38 -0000 1.28 *************** *** 208,215 **** // avoid crashing ! if (mcGS.mfGoalAltitude_m < mcTerrain.mfHeight_m + 20) { ! mcGS.mfGoalAltitude_m = mcTerrain.mfHeight_m + 20; } float dalt_m = mcGS.mfGoalAltitude_m - mcKin.mfAlt_m; --- 208,249 ---- // avoid crashing ! float& terrain_m = mcTerrain.mfHeight_m; ! ! // handle mountainous (high-alt) terrain differently ! float minAGL_m; ! float correction_m; ! ! if (readyForLanding) ! { ! minAGL_m = 10.0f; ! correction_m = 7.0f; ! } ! else if (terrain_m < 500.0f) ! { ! minAGL_m = 50.0f; ! correction_m = 75.0f; ! } ! else ! { ! minAGL_m = 200.0f; ! correction_m = 300.0f; ! } ! ! ! float correctedAltitude_m = mcGS.mfGoalAltitude_m; ! ! if (mcGS.mfGoalAltitude_m < mcTerrain.mfHeight_m + minAGL_m) { ! correctedAltitude_m = mcTerrain.mfHeight_m + correction_m; } + else if (mcGS.mfGoalAltitude_m < mcTerrain.lookAheadHeight_m + minAGL_m) + { + correctedAltitude_m = mcTerrain.lookAheadHeight_m + correction_m; + } + + if (correctedAltitude_m > mcGS.mfGoalAltitude_m) + { + mcGS.mfGoalAltitude_m = correctedAltitude_m; + } float dalt_m = mcGS.mfGoalAltitude_m - mcKin.mfAlt_m; *************** *** 219,225 **** if ((dalt_m > -0.5f)&&(dalt_m < 0.5f)&& (mcKin.mfClimbAngle_rad < C_PIOVER180*0.2f)&&(mcKin.mfClimbAngle_rad > -C_PIOVER180*0.2f)) ! { ! mcKin.mfClimbAngle_rad = 0; ! mcKin.mfPitch_rad = fAOA_rad; return; } --- 253,263 ---- if ((dalt_m > -0.5f)&&(dalt_m < 0.5f)&& (mcKin.mfClimbAngle_rad < C_PIOVER180*0.2f)&&(mcKin.mfClimbAngle_rad > -C_PIOVER180*0.2f)) ! { ! mcKin.mfClimbAngle_rad = 0; ! if (mcKin.mfClimbAngle_rad > maxPitch_rad) ! { ! mcKin.mfClimbAngle_rad = maxPitch_rad; ! } ! mcKin.mfPitch_rad = fAOA_rad; return; } *************** *** 243,247 **** ! dalt_max = fAltitudeRate_mps*dt_s; dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} // restrict to altitude rate --- 281,287 ---- ! ! ! dalt_max = (fuel_kg > 0) ? fAltitudeRate_mps * dt_s : -0.25f * fAltitudeRate_mps * dt_s; dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} // restrict to altitude rate *************** *** 263,266 **** --- 303,311 ---- mcKin.mfClimbAngle_rad = 0; } + + if (mcKin.mfClimbAngle_rad > maxPitch_rad) + { + mcKin.mfClimbAngle_rad = maxPitch_rad; + } mcKin.mfPitch_rad = mcKin.mfClimbAngle_rad + fAOA_rad; Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcLauncherState.cpp 2 Jul 2005 16:51:12 -0000 1.34 --- tcLauncherState.cpp 10 Sep 2005 21:47:38 -0000 1.35 *************** *** 346,350 **** } ! launchers[nLauncher]->msDatum.Set(lon_rad, lat_rad, alt_m); commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; --- 346,350 ---- } ! launchers[nLauncher]->SetDatum(lon_rad, lat_rad, alt_m); commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** Game.cpp 29 Jul 2005 02:35:53 -0000 1.139 --- Game.cpp 10 Sep 2005 21:47:38 -0000 1.140 *************** *** 43,46 **** --- 43,47 ---- #include "tcString.h" #include "tcSimPythonInterface.h" + #include "tcScenarioInterface.h" #include "cspDate.h" #include "tcDirector.h" *************** *** 62,65 **** --- 63,67 ---- #include "tcStoresGui.h" #include "tcPlatformGui.h" + #include "tcBriefingView.h" #if defined(_MSC_VER) *************** *** 90,93 **** --- 92,96 ---- EVT_COMMAND(ID_SCENARIOSELECTVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToScenarioSelect) EVT_COMMAND(ID_MULTIPLAYERVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToNetwork) + EVT_COMMAND(ID_BRIEFINGVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToBriefing) EVT_COMMAND(ID_ENDGAME, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::EndGame) EVT_COMMAND(ID_STARTGAME, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::StartGame) *************** *** 230,233 **** --- 233,237 ---- briefingConsoleLeft->SetActive(false); briefingConsoleBottom->SetActive(false); + briefingView->SetActive(false); chatBox->SetActive(false); displaySettingsView->SetActive(false); *************** *** 243,247 **** viewer->SetActive(false); worldMap->SetActive(false); ! // undo initialization UninitGame(); --- 247,255 ---- viewer->SetActive(false); worldMap->SetActive(false); ! ! briefingView->SetButtonCaption(ID_STARTVIEW, "Return"); ! ! pythonInterface->GetScenarioInterface()->ClearSimpleBriefing(); ! // undo initialization UninitGame(); *************** *** 251,262 **** if (!simState->IsMultiplayerActive()) { - simState->RandInit(); // generate new random scenario - - HookRandomFriendly(); - // reset time gameTime = 0; directorTime = 0; nLastCount = 0; // clear briefing console text --- 259,267 ---- if (!simState->IsMultiplayerActive()) { // reset time gameTime = 0; directorTime = 0; nLastCount = 0; + accelerateTime = 1; // clear briefing console text *************** *** 267,271 **** director->ClearEvents(); director->SetStartTime(0); ! director->InitTest(); // load test event sequence (for random scen) } --- 272,289 ---- director->ClearEvents(); director->SetStartTime(0); ! ! // try to reload last scenario played ! std::string lastPath = tcOptions::Get()->GetOptionString("LastScenarioPath"); ! std::string lastName = tcOptions::Get()->GetOptionString("LastScenarioName"); ! ! if ((lastName.length() > 2) && (lastName != "default")) ! { ! scenarioSelectView->LoadScenario(lastPath, lastName); ! } ! ! if (simState->IsScenarioLoaded()) ! { ! HookRandomFriendly(); ! } } *************** *** 343,347 **** meGameMode = GM_PLAY; ! meScreenMode = TACTICAL; } else --- 361,366 ---- meGameMode = GM_PLAY; ! meScreenMode = SIMPLEBRIEF; ! briefingView->SetButtonCaption(ID_STARTVIEW, "PLAY"); } else *************** *** 351,354 **** --- 370,380 ---- } + void tcGame::SwitchToBriefing(wxCommandEvent& event) + { + if (meGameMode != GM_START) return; + + meScreenMode = SIMPLEBRIEF; + } + void tcGame::SwitchToCredit(wxCommandEvent& event) { *************** *** 583,587 **** try { ! // try to load last scenario played, otherwise use random scenario std::string lastPath = tcOptions::Get()->GetOptionString("LastScenarioPath"); std::string lastName = tcOptions::Get()->GetOptionString("LastScenarioName"); --- 609,613 ---- try { ! // try to load last scenario played std::string lastPath = tcOptions::Get()->GetOptionString("LastScenarioPath"); std::string lastName = tcOptions::Get()->GetOptionString("LastScenarioName"); *************** *** 597,606 **** } ! HookRandomFriendly(); } catch(std::string s) { std::string message; ! message += "Error during RandInit: "; message += s; wxMessageBox(message.c_str(), "Fatal error", wxICON_ERROR); --- 623,635 ---- } ! if (simState->IsScenarioLoaded()) ! { ! HookRandomFriendly(); ! } } catch(std::string s) { std::string message; ! message += "Error during scenario loading: "; message += s; wxMessageBox(message.c_str(), "Fatal error", wxICON_ERROR); *************** *** 609,613 **** catch (...) { ! wxMessageBox("Unknown error during RandInit", "Fatal error", wxICON_ERROR); throw; } --- 638,642 ---- catch (...) { ! wxMessageBox("Unknown error during scenario loading", "Fatal error", wxICON_ERROR); throw; } *************** *** 785,788 **** --- 814,820 ---- briefingConsoleBottom->Print(" "); // need this to get it to display + briefingView = new tcBriefingView(glCanvas, wxPoint(0, 0), wxSize(mnWidth, mnHeight)); + briefingView->SetActive(false); + briefingView->SetButtonCaption(ID_STARTVIEW, "Return"); } *************** *** 914,925 **** bool tcGame::InitGame() { /* ** Info console init * **/ mrectLowerLeft.left = 0; mrectLowerLeft.top = mnHeight-200; ! mrectLowerLeft.right = 200; mrectLowerLeft.bottom = mnHeight; infoConsole = new tcSoundConsole(glCanvas, ! wxPoint(mrectLowerLeft.left, mrectLowerLeft.top), wxSize(200,200), "xml/info_console.xml", "InfoConsole"); infoConsole->SetBaseRenderBin(30); --- 946,959 ---- bool tcGame::InitGame() { + int panelWidth = (mnWidth > 1000) ? 200 : 150; /* ** Info console init * **/ mrectLowerLeft.left = 0; mrectLowerLeft.top = mnHeight-200; ! mrectLowerLeft.right = panelWidth; mrectLowerLeft.bottom = mnHeight; infoConsole = new tcSoundConsole(glCanvas, ! wxPoint(mrectLowerLeft.left, mrectLowerLeft.top), ! wxSize(panelWidth, mrectLowerLeft.bottom - mrectLowerLeft.top), "xml/info_console.xml", "InfoConsole"); infoConsole->SetBaseRenderBin(30); *************** *** 941,946 **** /* ** hookInfo init * **/ ! hookInfo = new tcHookInfo(glCanvas, wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), ! wxSize(200,200)); hookInfo->SetBaseRenderBin(30); if (!hookInfo) --- 975,982 ---- /* ** hookInfo init * **/ ! hookInfo = new tcHookInfo(glCanvas, ! wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), ! wxSize(panelWidth, mrectLowerLeft.bottom - mrectLowerLeft.top)); ! hookInfo->SetBaseRenderBin(30); if (!hookInfo) *************** *** 957,961 **** // objectControl init ! objectControl = new tcObjectControl(glCanvas, wxPoint(mrectLowerLeft.right+200,mrectLowerLeft.top), wxSize(mnWidth-400,200)); //objectControl->SetBaseRenderBin(20); if (!objectControl) --- 993,999 ---- // objectControl init ! objectControl = new tcObjectControl(glCanvas, ! wxPoint(mrectLowerLeft.right+panelWidth, mrectLowerLeft.top), ! wxSize(mnWidth-2*panelWidth, 200)); //objectControl->SetBaseRenderBin(20); if (!objectControl) *************** *** 973,979 **** mrectOOB.left = 0; mrectOOB.top = 0; ! mrectOOB.right = 200; mrectOOB.bottom = mnHeight-200; ! oobView = new tcOOBView(glCanvas, wxPoint(mrectOOB.left,mrectOOB.top), wxSize(mrectOOB.right-mrectOOB.left, mrectOOB.bottom-mrectOOB.top)); oobView->SetBaseRenderBin(20); oobView->MoveToTop(); --- 1011,1018 ---- mrectOOB.left = 0; mrectOOB.top = 0; ! mrectOOB.right = panelWidth; mrectOOB.bottom = mnHeight-200; ! oobView = new tcOOBView(glCanvas, wxPoint(mrectOOB.left,mrectOOB.top), ! wxSize(mrectOOB.right-mrectOOB.left, mrectOOB.bottom-mrectOOB.top)); oobView->SetBaseRenderBin(20); oobView->MoveToTop(); *************** *** 1046,1050 **** pythonInterface->AttachConsole(infoConsole); // sensor maps get cleared in tcSimState::RandInit() ! pythonInterface->AttachSensorMap(simState->mcSensorMap.GetMap(userInfo->GetOwnAlliance())); mcGameView.AttachObjectControl(objectControl); --- 1085,1089 ---- pythonInterface->AttachConsole(infoConsole); // sensor maps get cleared in tcSimState::RandInit() ! pythonInterface->AttachSensorMap(simState->mcSensorMap.GetOrCreateMap(userInfo->GetOwnAlliance())); mcGameView.AttachObjectControl(objectControl); *************** *** 1080,1083 **** --- 1119,1127 ---- briefingConsoleLeft->Clear(); + + pythonInterface->AttachConsole(0); + mcGameView.AttachObjectControl(0); + messageCenter->AttachConsole(0); + } *************** *** 1384,1387 **** --- 1428,1432 ---- networkView->SetActive(false); chatBox->SetActive(false); + briefingView->SetActive(false); } *************** *** 1416,1419 **** --- 1461,1468 ---- networkView->Draw(); break; + case SIMPLEBRIEF: + briefingView->SetActive(true); + briefingView->Draw(); + break; } viewer->SetActive(true); *************** *** 1531,1534 **** --- 1580,1584 ---- briefingConsoleLeft->SetActive(false); briefingConsoleBottom->SetActive(false); + briefingView->SetActive(false); chatBox->SetActive(false); displaySettingsView->SetActive(false); *************** *** 1624,1627 **** --- 1674,1683 ---- draggedIconDisplay->Draw(); } + else if (meScreenMode == SIMPLEBRIEF) + { + briefingView->SetActive(true); + + briefingView->Draw(); + } else if (meScreenMode == OPTIONS) { *************** *** 1742,1746 **** } } ! directorTime += fdt; dateTimeString = gameDateZulu.asString(); if (mbPaused) --- 1798,1802 ---- } } ! if (meScreenMode != SIMPLEBRIEF) directorTime += fdt; // run director when not in simple brief mode dateTimeString = gameDateZulu.asString(); if (mbPaused) *************** *** 1840,1844 **** viewer->Update(gameDateZulu); ! if ((directorTime > 0.1f) && doRender) { viewer->Frame(); --- 1896,1900 ---- viewer->Update(gameDateZulu); ! if (doRender) // if ((directorTime > 0.1f) && doRender) { viewer->Frame(); *************** *** 2205,2209 **** case 'a': accelerateTime = 2*(accelerateTime + 1) - 1; ! if (accelerateTime > 15) { accelerateTime = 0; // return to normal time after 8x --- 2261,2265 ---- case 'a': accelerateTime = 2*(accelerateTime + 1) - 1; ! if (accelerateTime > 31) { accelerateTime = 0; // return to normal time after 8x *************** *** 2214,2230 **** if (chatBox->mbActive) chatBox->MoveToTop(); return; ! case 'g': ! enableGraphicsEngine = !enableGraphicsEngine; ! return; ! case 'h': ! { ! //tcPopupMessage* msg = new tcPopupMessage("TEST", wxPoint(50, 50), 100); ! //msg->SetActive(true); ! tcContainerGui* gui = new tcContainerGui(wxPoint(250, 50), "xml/test_container.xml", "TestContainer"); ! } ! return; ! case 'm': ! enableTacticalMap = !enableTacticalMap; ! return; case 'p': if (!mbScenarioEdit) mbPaused = !mbPaused; --- 2270,2279 ---- if (chatBox->mbActive) chatBox->MoveToTop(); return; ! //case 'g': ! // enableGraphicsEngine = !enableGraphicsEngine; ! // return; ! //case 'm': ! // enableTacticalMap = !enableTacticalMap; ! // return; case 'p': if (!mbScenarioEdit) mbPaused = !mbPaused; *************** *** 2354,2358 **** tsCommandInfo cmd_info; ! if(commandQueue->GetCommand(cmd_info)) { if (cmd_info.mbUsePython) --- 2403,2407 ---- tsCommandInfo cmd_info; ! if (commandQueue->GetCommand(cmd_info)) { if (cmd_info.mbUsePython) *************** *** 2385,2395 **** infoConsole->Print(cmd_info.mzString); } else { ! if (cmd_info.meCmd == GC_QUIT) // a hack for now ! { ! mbQuit = true; ! } ! // ProcessCommand(cmd_info.meCmd,cmd_info.mfData,cmd_info.mnData,cmd_info.mnData2); } } --- 2434,2453 ---- infoConsole->Print(cmd_info.mzString); } + else if (cmd_info.meCmd == GC_QUIT) + { + mbQuit = true; + } + else if (cmd_info.meCmd == GC_SHOWBRIEFING) + { + meScreenMode = SIMPLEBRIEF; + } + else if (cmd_info.meCmd == GC_SHOWMISSIONSTATUS) + { + meScreenMode = MESSAGES; + messageCenter->ActivateChannel("Mission"); + } else { ! fprintf(stderr, "Unrecognized command (%d)\n", cmd_info.meCmd); } } *************** *** 2617,2620 **** --- 2675,2685 ---- std::cout << "Game constructor success" << std::endl; + + // popup warning if game is run lower than 1024 x 768 + if (mnWidth < 1024) + { + wxMessageBox("Graphics layout will not display properly at resolutions lower than 1024 x 768", + "GCB screen resolution warning", wxICON_WARNING); + } } Index: tcBallisticWeapon.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcBallisticWeapon.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcBallisticWeapon.cpp 5 May 2005 02:14:54 -0000 1.14 --- tcBallisticWeapon.cpp 10 Sep 2005 21:47:38 -0000 1.15 *************** *** 98,102 **** mcKin.mfSpeed_kts = obj->mcKin.mfSpeed_kts; mcKin.mfHeading_rad = obj->mcKin.mfHeading_rad; ! mcKin.mfPitch_rad = obj->mcKin.mfPitch_rad; mfStatusTime = obj->mfStatusTime; --- 98,108 ---- mcKin.mfSpeed_kts = obj->mcKin.mfSpeed_kts; mcKin.mfHeading_rad = obj->mcKin.mfHeading_rad; ! ! /* use parent platform climb angle for pitch, since pitch determines vertical ! ** velocity for ballistic objects. For gravity bombs we want zero initial vertical ! ** velocity if parent plaform is in level flight. ! */ ! mcKin.mfPitch_rad = obj->mcKin.mfClimbAngle_rad; ! mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; mfStatusTime = obj->mfStatusTime; *************** *** 109,115 **** if (mpDBObject->IsGunRound()) { ! mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; ! GeoPoint targetDatum = pLauncher->msDatum; mcKin.mfHeading_rad = mcKin.HeadingToGeoRad(&targetDatum); --- 115,145 ---- if (mpDBObject->IsGunRound()) { ! GeoPoint targetDatum; ! tcTrack targetTrack; ! targetTrack.Clear(); ! // if the launcher has a target, set launch az based on projected position ! if (simState->GetTruthTrack(pLauncher->mnTargetID, targetTrack)) ! { ! targetDatum.mfLon_rad = targetTrack.mfLon_rad; ! targetDatum.mfLat_rad = targetTrack.mfLat_rad; ! targetDatum.mfAlt_m = targetTrack.mfAlt_m; ! ! float range_m = 1000.0f * mcKin.RangeToKm(&targetDatum); ! float dz_m = targetDatum.mfAlt_m - mcKin.mfAlt_m; ! float tti_s; ! ! mpDBObject->GetGunneryElevation(range_m, dz_m, tti_s); ! targetTrack = targetTrack.PredictAhead(tti_s); ! targetDatum.mfLon_rad = targetTrack.mfLon_rad; ! targetDatum.mfLat_rad = targetTrack.mfLat_rad; ! targetDatum.mfAlt_m = targetTrack.mfAlt_m; ! } ! else ! { ! targetDatum = pLauncher->msDatum; ! } ! ! mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; mcKin.mfHeading_rad = mcKin.HeadingToGeoRad(&targetDatum); *************** *** 119,122 **** --- 149,160 ---- mcKin.mfPitch_rad = mpDBObject->GetGunneryElevation(range_m, dz_m, tti_s); + + // add some error to launch az and el + mcKin.mfPitch_rad += randfc(0.006); + mcKin.mfHeading_rad += randfc(0.006); + + mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; + + /* *************** *** 155,158 **** --- 193,197 ---- } + wxString s = wxString::Format("Ball %d-%d", obj->mnID, rand() % 1000); mzUnit = s.c_str(); Index: tcSensorPlatform.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorPlatform.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcSensorPlatform.cpp 29 Jul 2005 02:35:53 -0000 1.9 --- tcSensorPlatform.cpp 10 Sep 2005 21:47:38 -0000 1.10 *************** *** 29,32 **** --- 29,33 ---- #include "tcSensorPlatformDBObject.h" #include "tcSonarDBObject.h" + #include "tcGameObject.h" #include "tcESMSensor.h" #include "tcRadar.h" *************** *** 428,431 **** --- 429,433 ---- wxASSERT(sensor); + sensor->mfSensorHeight_m = 0.1f * parent->GetSpan(); //< guess sensor height is 10% of length sensor->SetMountAz(0); sensorState.push_back(sensor); Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcAeroAirObject.cpp 20 Jul 2005 16:24:54 -0000 1.19 --- tcAeroAirObject.cpp 10 Sep 2005 21:47:38 -0000 1.20 *************** *** 322,335 **** angleOfAttack = aoaConstant / ias_mps; if (ias_mps <= mpDBObject->stallSpeed_mps) { throttleFraction = 1.0f; ! mcGS.mfGoalAltitude_m = k.mfAlt_m - 50.0f; // avoid flooding connection with stall adjustments inducedDrag_N = 0; // stall, no induced drag } ! else { // assumes level flight inducedDrag_N = mpDBObject->mfKdi * weight_N * angleOfAttack; } --- 322,342 ---- angleOfAttack = aoaConstant / ias_mps; + const float stallPitch = -0.1f; if (ias_mps <= mpDBObject->stallSpeed_mps) { throttleFraction = 1.0f; ! //mcGS.mfGoalAltitude_m = k.mfAlt_m - 50.0f; // avoid flooding connection with stall adjustments ! maxPitch_rad = stallPitch; inducedDrag_N = 0; // stall, no induced drag } ! else if (ias_mps <= mpDBObject->stallSpeed_mps + 50.0f) { + maxPitch_rad = stallPitch + 0.02f * (ias_mps - mpDBObject->stallSpeed_mps); + } + else + { // assumes level flight + maxPitch_rad = 1.0f + stallPitch; inducedDrag_N = mpDBObject->mfKdi * weight_N * angleOfAttack; } *************** *** 347,351 **** if (k.mfSpeed_kts > mpDBObject->mfMaxSpeed_kts) k.mfSpeed_kts = mpDBObject->mfMaxSpeed_kts; ! else if (k.mfSpeed_kts < 40.0) { // shouldn't happen, but limit speed to 40 and slowly dive in this case --- 354,358 ---- if (k.mfSpeed_kts > mpDBObject->mfMaxSpeed_kts) k.mfSpeed_kts = mpDBObject->mfMaxSpeed_kts; ! else if (k.mfSpeed_kts <= 40.0) { // shouldn't happen, but limit speed to 40 and slowly dive in this case Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcRadar.cpp 7 Jul 2005 01:13:44 -0000 1.32 --- tcRadar.cpp 10 Sep 2005 21:47:38 -0000 1.33 *************** *** 175,179 **** } ! float fRadarHorizon = C_RADARHOR*(sqrtf(tgt_kin->mfAlt_m) +sqrtf(rdr_kin->mfAlt_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, tgt_kin->mfLat_rad,tgt_kin->mfLon_rad); --- 175,179 ---- } ! float fRadarHorizon = C_RADARHOR*(sqrtf(tgt_kin->mfAlt_m) +sqrtf(rdr_kin->mfAlt_m + mfSensorHeight_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, tgt_kin->mfLat_rad,tgt_kin->mfLon_rad); |