Thread: [Gcblue-commits] gcb_wx/src/sim Game.cpp,1.104,1.105 tcAirObject.cpp,1.13,1.14 tcDirectorEvent.cpp,1
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-11-14 22:52:34
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22147/src/sim Modified Files: Game.cpp tcAirObject.cpp tcDirectorEvent.cpp tcSimState.cpp Log Message: Text message "message center" GUI screen Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** tcSimState.cpp 7 Nov 2004 03:40:45 -0000 1.57 --- tcSimState.cpp 14 Nov 2004 22:52:22 -0000 1.58 *************** *** 49,52 **** --- 49,53 ---- #include "tcCommandObject.h" #include "common/tcStream.h" + #include "tcMessageInterface.h" #ifdef _DEBUG *************** *** 341,345 **** #endif } ! /********************************************************************/ /** --- 342,347 ---- #endif } ! ! /** *************** *** 369,377 **** missile->mfDamageLevel += 1.0f; // missile destroys itself on impact if (fDamageFract > 0) { if (mpUserInfo->IsOwnAlliance(target->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_IMPLOSION); } else --- 371,380 ---- missile->mfDamageLevel += 1.0f; // missile destroys itself on impact + if (fDamageFract > 0) { if (mpUserInfo->IsOwnAlliance(target->mnAlliance)) { ! ReportDamage(target); } else *************** *** 381,389 **** } ! tcString s; ! s.Format("weapon %d hit target %d, range^2: %3.1f m, dmg: %3.1f %%, time %.1f s", missile->mnID, target->mnID, trueRange2, fDamageFract, 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); --- 384,392 ---- } ! ! wxString s = wxString::Format("weapon %d hit target %d, range^2: %3.1f m, dmg: %3.1f %%, time %.1f s", missile->mnID, target->mnID, trueRange2, fDamageFract, mfSimTime); ! WTL(s.c_str()); ! std::cout << s.c_str(); fprintf(stdout," collision relative time: %f, dx:%f dy:%f dz:%f\n", tclosest, dx, dy, dz); *************** *** 458,462 **** if (mpUserInfo->IsOwnAlliance(target->mnAlliance)) { ! tcSound::Get()->PlayEffect(SEFFECT_IMPLOSION); } else --- 461,465 ---- if (mpUserInfo->IsOwnAlliance(target->mnAlliance)) { ! ReportDamage(target); } else *************** *** 790,794 **** return nListIndex; } ! /********************************************************************/ void tcSimState::RemoveDestroyedObjects() { --- 793,799 ---- return nListIndex; } ! /** ! * ! */ void tcSimState::RemoveDestroyedObjects() { *************** *** 808,813 **** } ! /********************************************************************/ void tcSimState::ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, tcRadar *apRadarSS) --- 813,840 ---- } + /** + * Writes out damage report message + */ + void tcSimState::ReportDamage(tcGameObject* obj) + { + tcSound::Get()->PlayEffect(SEFFECT_IMPLOSION); ! std::string damageString = "reports light damage"; ! ! if (obj->mfDamageLevel >= 1.0) damageString = "destroyed"; ! else if (obj->mfDamageLevel >= 0.5) damageString = "reports heavy damage"; ! else if (obj->mfDamageLevel >= 0.2) damageString = "reports moderate damage"; ! ! ! wxString s = wxString::Format("%s: %s (%s) %s\n", ! dateZulu.asString().c_str(), obj->mzUnit.mz, obj->mzClass.mz, ! damageString.c_str()); ! ! tcMessageInterface::Get()->ChannelMessage("Damage", s.c_str()); ! } ! ! /** ! * ! */ void tcSimState::ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, tcRadar *apRadarSS) *************** *** 1538,1541 **** --- 1565,1578 ---- } + // load high res map if necessary + 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); + } + msScenarioInfo.mbLoaded = true; } Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcAirObject.cpp 7 Nov 2004 03:40:45 -0000 1.13 --- tcAirObject.cpp 14 Nov 2004 22:52:22 -0000 1.14 *************** *** 185,192 **** } ! // Has problems for large time steps, > about 1 sec void tcAirObject::UpdateClimb(float dt_s) { float dalt_min, dalt_max, fAltitudeRate_mps; float dalt_m = mcGS.mfGoalAltitude_m - mcKin.mfAlt_m; // float valt_kts = (daltitude_m/dt_s)*C_MPSTOKTS; --- 185,202 ---- } ! /** ! * Update climb related parameters. This has problems for large time ! * steps, > about 1 sec ! */ void tcAirObject::UpdateClimb(float dt_s) { float dalt_min, dalt_max, fAltitudeRate_mps; + + // restrict to max altitude + if (mcGS.mfGoalAltitude_m > mpDBObject->mfMaxAltitude_m) + { + mcGS.mfGoalAltitude_m = mpDBObject->mfMaxAltitude_m; + } + float dalt_m = mcGS.mfGoalAltitude_m - mcKin.mfAlt_m; // float valt_kts = (daltitude_m/dt_s)*C_MPSTOKTS; Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** Game.cpp 6 Nov 2004 15:13:42 -0000 1.104 --- Game.cpp 14 Nov 2004 22:52:21 -0000 1.105 *************** *** 48,51 **** --- 48,53 ---- #include "tcDirector.h" #include "tcXmlWindow.h" + #include "tcMessageCenter.h" + #include "tcMessageInterface.h" #include "tcNetworkView.h" #include "tcDisplaySettingsView.h" *************** *** 53,56 **** --- 55,59 ---- #include "tcChatBox.h" #include "tc3DWindow.h" + #include "tcPopupMessage.h" #if defined(_MSC_VER) *************** *** 124,127 **** --- 127,133 ---- popupControl = NULL; director = NULL; + networkView = NULL; + messageCenter = NULL; + SetBackgroundColour(*wxBLACK); Show(FALSE); *************** *** 288,302 **** briefingConsoleLeft->SetActive(false); briefingConsoleBottom->SetActive(false); ! optionsView->SetActive(false); ! tacticalMap->SetActive(false); ! worldMap->SetActive(false); ! infoConsole->SetActive(false); hookInfo->SetActive(false); objectControl->SetActive(false); oobView->SetActive(false); ! viewer->SetActive(false); popupControl->SetActive(false); ! chatBox->SetActive(false); ! // undo initialization UninitGame(); --- 294,311 ---- briefingConsoleLeft->SetActive(false); briefingConsoleBottom->SetActive(false); ! chatBox->SetActive(false); ! displaySettingsView->SetActive(false); hookInfo->SetActive(false); + infoConsole->SetActive(false); + messageCenter->SetActive(false); + networkView->SetActive(false); objectControl->SetActive(false); oobView->SetActive(false); ! optionsView->SetActive(false); popupControl->SetActive(false); ! tacticalMap->SetActive(false); ! viewer->SetActive(false); ! worldMap->SetActive(false); ! // undo initialization UninitGame(); *************** *** 367,370 **** --- 376,382 ---- viewer->ClearDefaultTextObjects(); + // clear message center + messageCenter->Clear(); + tcString s; s.Format("Starting scenario: %s",simState->msScenarioInfo.mzName); *************** *** 516,519 **** --- 528,534 ---- InitializeNetworkView(); + + InitializeMessageCenter(); + InitializeScenarioSelectView(); *************** *** 721,726 **** /** * Initialize network view interface - * startView must be initialized before calling this */ void tcGame::InitializeNetworkView() --- 736,754 ---- /** + * Initialize MessageCenter view interface + */ + void tcGame::InitializeMessageCenter() + { + wxASSERT(glCanvas); + + messageCenter = new tcMessageCenter(glCanvas, wxPoint(0,0), frameSize, "MessageCenter"); + messageCenter->SetBaseRenderBin(30); + + tcMessageInterface::SetMessageCenter(messageCenter); + + } + + /** * Initialize network view interface */ void tcGame::InitializeNetworkView() *************** *** 1003,1006 **** --- 1031,1035 ---- wxASSERT(tacticalMap); + tcPopupMessage::SetParent(tacticalMap); #if 0 *************** *** 1360,1363 **** --- 1389,1393 ---- displaySettingsView->SetActive(false); scenarioSelectView->SetActive(false); + messageCenter->SetActive(false); networkView->SetActive(false); chatBox->SetActive(false); *************** *** 1497,1511 **** void tcGame::UpdateForScreenMode() { ! bool drawEdgeWindows = (size3D != MODE3D_FULL) || (!mb3DActive); ! bool drawTacticalMap = (size3D == MODE3D_SMALL) || (!mb3DActive); if (meScreenMode == TACTICAL) ! { if (tacticalMapSize == TM_MEDIUM) SetTacticalMapSize(TM_LARGE); ! briefingConsoleLeft->SetActive(false); ! briefingConsoleBottom->SetActive(false); ! optionsView->SetActive(false); ! networkView->SetActive(false); ! displaySettingsView->SetActive(false); tacticalMap->SetActive(drawTacticalMap); worldMap->SetActive(drawTacticalMap); --- 1527,1558 ---- void tcGame::UpdateForScreenMode() { ! static teScreenMode lastMode = NONE; ! ! if (meScreenMode != lastMode) ! { ! briefingConsoleLeft->SetActive(false); ! briefingConsoleBottom->SetActive(false); ! chatBox->SetActive(false); ! displaySettingsView->SetActive(false); ! hookInfo->SetActive(false); ! infoConsole->SetActive(false); ! optionsView->SetActive(false); ! messageCenter->SetActive(false); ! networkView->SetActive(false); ! objectControl->SetActive(false); ! oobView->SetActive(false); ! tacticalMap->SetActive(false); ! viewer->SetActive(false); ! worldMap->SetActive(false); ! } ! lastMode = meScreenMode; ! if (meScreenMode == TACTICAL) ! { ! bool drawEdgeWindows = (size3D != MODE3D_FULL) || (!mb3DActive); ! bool drawTacticalMap = (size3D == MODE3D_SMALL) || (!mb3DActive); if (tacticalMapSize == TM_MEDIUM) SetTacticalMapSize(TM_LARGE); ! tacticalMap->SetActive(drawTacticalMap); worldMap->SetActive(drawTacticalMap); *************** *** 1536,1551 **** else if (meScreenMode == TACTICALBRIEF) { if (tacticalMapSize == TM_LARGE) SetTacticalMapSize(TM_MEDIUM); briefingConsoleLeft->SetActive(drawEdgeWindows); briefingConsoleBottom->SetActive(drawEdgeWindows); ! optionsView->SetActive(false); ! networkView->SetActive(false); ! displaySettingsView->SetActive(false); tacticalMap->SetActive(drawTacticalMap); worldMap->SetActive(drawTacticalMap); - infoConsole->SetActive(false); - hookInfo->SetActive(false); - objectControl->SetActive(false); - oobView->SetActive(false); viewer->SetActive(mb3DActive); if (drawTacticalMap) --- 1583,1596 ---- else if (meScreenMode == TACTICALBRIEF) { + bool drawEdgeWindows = (size3D != MODE3D_FULL) || (!mb3DActive); + bool drawTacticalMap = (size3D == MODE3D_SMALL) || (!mb3DActive); + if (tacticalMapSize == TM_LARGE) SetTacticalMapSize(TM_MEDIUM); + briefingConsoleLeft->SetActive(drawEdgeWindows); briefingConsoleBottom->SetActive(drawEdgeWindows); ! tacticalMap->SetActive(drawTacticalMap); worldMap->SetActive(drawTacticalMap); viewer->SetActive(mb3DActive); if (drawTacticalMap) *************** *** 1566,1624 **** else if (meScreenMode == OPTIONS) { - - briefingConsoleLeft->SetActive(false); - briefingConsoleBottom->SetActive(false); - optionsView->SetActive(true); ! networkView->SetActive(false); ! displaySettingsView->SetActive(false); ! tacticalMap->SetActive(false); ! worldMap->SetActive(false); ! infoConsole->SetActive(false); ! hookInfo->SetActive(false); ! ! ! oobView->SetActive(false); ! objectControl->SetActive(false); ! viewer->SetActive(false); ! ! ! chatBox->SetActive(false); ! ! optionsView->Draw(); } else if (meScreenMode == NETWORK) { - briefingConsoleLeft->SetActive(false); - briefingConsoleBottom->SetActive(false); - optionsView->SetActive(false); networkView->SetActive(true); ! displaySettingsView->SetActive(false); ! tacticalMap->SetActive(false); ! worldMap->SetActive(false); ! infoConsole->SetActive(false); ! hookInfo->SetActive(false); ! oobView->SetActive(false); ! objectControl->SetActive(false); ! viewer->SetActive(false); ! chatBox->SetActive(false); networkView->Draw(); } else if (meScreenMode == DISPLAYSETTINGS) { - briefingConsoleLeft->SetActive(false); - briefingConsoleBottom->SetActive(false); - optionsView->SetActive(false); - networkView->SetActive(false); displaySettingsView->SetActive(true); - tacticalMap->SetActive(false); - worldMap->SetActive(false); - infoConsole->SetActive(false); - hookInfo->SetActive(false); - oobView->SetActive(false); - objectControl->SetActive(false); - viewer->SetActive(false); - chatBox->SetActive(false); displaySettingsView->Draw(); --- 1611,1633 ---- else if (meScreenMode == OPTIONS) { optionsView->SetActive(true); ! optionsView->Draw(); } + else if (meScreenMode == MESSAGES) + { + messageCenter->SetActive(true); + + messageCenter->Draw(); + } else if (meScreenMode == NETWORK) { networkView->SetActive(true); ! networkView->Draw(); } else if (meScreenMode == DISPLAYSETTINGS) { displaySettingsView->SetActive(true); displaySettingsView->Draw(); *************** *** 2115,2118 **** --- 2124,2133 ---- enableGraphicsEngine = !enableGraphicsEngine; return; + case 'h': + { + tcPopupMessage* msg = new tcPopupMessage("TEST", wxPoint(50, 50), 100); + msg->SetActive(true); + } + return; case 'm': enableTacticalMap = !enableTacticalMap; *************** *** 2175,2178 **** --- 2190,2203 ---- } return; + case WXK_F7: + if (meScreenMode == MESSAGES) + { + meScreenMode = TACTICAL; + } + else + { + meScreenMode = MESSAGES; + } + return; case WXK_F8: viewer->ToggleWireframe(); Index: tcDirectorEvent.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcDirectorEvent.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcDirectorEvent.cpp 2 Nov 2004 04:23:56 -0000 1.12 --- tcDirectorEvent.cpp 14 Nov 2004 22:52:22 -0000 1.13 *************** *** 35,38 **** --- 35,40 ---- #include "tc3DViewer.h" #include "math_constants.h" + #include "tcMessageInterface.h" + #include <osgText/Text> #include <osg/Vec3> // tc3DTextEvent *************** *** 258,261 **** --- 260,265 ---- console->Print(text.c_str()); + tcMessageInterface::Get()->ChannelMessage("Briefing", text); + triggered = true; } |