gcblue-commits Mailing List for Global Conflict Blue (Page 11)
Status: Alpha
                
                Brought to you by:
                
                    ddcforge
                    
                
            You can subscribe to this list here.
| 2003 | 
          Jan
           | 
        
        
        
        
          Feb
           | 
        
        
        
        
          Mar
           | 
        
        
        
        
          Apr
           | 
        
        
        
        
          May
           | 
        
        
        
        
          Jun
           | 
        
        
        
        
          Jul
           | 
        
        
        
        
          Aug
           | 
        
        
        
        
          Sep
           | 
        
        
        
        
          Oct
           | 
        
        
        
        
          Nov
           | 
        
        
        
        
          Dec
           (6)  | 
        
      
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 | 
          Jan
           (112)  | 
        
        
        
        
          Feb
           (106)  | 
        
        
        
        
          Mar
           (88)  | 
        
        
        
        
          Apr
           (111)  | 
        
        
        
        
          May
           (53)  | 
        
        
        
        
          Jun
           (60)  | 
        
        
        
        
          Jul
           (58)  | 
        
        
        
        
          Aug
           (61)  | 
        
        
        
        
          Sep
           (45)  | 
        
        
        
        
          Oct
           (31)  | 
        
        
        
        
          Nov
           (71)  | 
        
        
        
        
          Dec
           (70)  | 
        
      
| 2005 | 
          Jan
           (33)  | 
        
        
        
        
          Feb
           (57)  | 
        
        
        
        
          Mar
           (98)  | 
        
        
        
        
          Apr
           (47)  | 
        
        
        
        
          May
           (53)  | 
        
        
        
        
          Jun
           (79)  | 
        
        
        
        
          Jul
           (79)  | 
        
        
        
        
          Aug
           | 
        
        
        
        
          Sep
           (33)  | 
        
        
        
        
          Oct
           (1)  | 
        
        
        
        
          Nov
           (20)  | 
        
        
        
        
          Dec
           (64)  | 
        
      
| 2006 | 
          Jan
           (20)  | 
        
        
        
        
          Feb
           (1)  | 
        
        
        
        
          Mar
           (43)  | 
        
        
        
        
          Apr
           (11)  | 
        
        
        
        
          May
           (8)  | 
        
        
        
        
          Jun
           (23)  | 
        
        
        
        
          Jul
           | 
        
        
        
        
          Aug
           (28)  | 
        
        
        
        
          Sep
           (58)  | 
        
        
        
        
          Oct
           (25)  | 
        
        
        
        
          Nov
           (47)  | 
        
        
        
        
          Dec
           (70)  | 
        
      
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-06-06 00:06:36
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv18053 Modified Files: GCblue.sln GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** GCblue.vcproj 23 Mar 2006 01:11:25 -0000 1.103 --- GCblue.vcproj 6 Jun 2006 00:06:20 -0000 1.104 *************** *** 379,382 **** --- 379,386 ---- </File> <File + RelativePath=".\src\graphics\tcDatabaseViewer.cpp" + > + </File> + <File RelativePath=".\src\graphics\tcDisplayModes.cpp" > *************** *** 467,470 **** --- 471,478 ---- </File> <File + RelativePath=".\src\graphics\tcMPGameView.cpp" + > + </File> + <File RelativePath=".\src\graphics\tcNetworkView.cpp" > *************** *** 1661,1664 **** --- 1669,1676 ---- </File> <File + RelativePath=".\include\graphics\tcDatabaseViewer.h" + > + </File> + <File RelativePath=".\include\graphics\tcDisplayModes.h" > *************** *** 1733,1736 **** --- 1745,1752 ---- </File> <File + RelativePath=".\include\graphics\tcMPGameView.h" + > + </File> + <File RelativePath=".\include\graphics\tcNetworkView.h" > Index: GCblue.sln =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.sln,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GCblue.sln 6 Mar 2004 20:52:28 -0000 1.2 --- GCblue.sln 6 Jun 2006 00:06:20 -0000 1.3 *************** *** 1,21 **** ! Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GCblue", "GCblue.vcproj", "{76C3883D-96DD-4A32-91C5-2ADA4CA505E7}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection EndProject Global ! GlobalSection(SolutionConfiguration) = preSolution ! Debug = Debug ! Release = Release ! EndGlobalSection ! GlobalSection(ProjectConfiguration) = postSolution ! {76C3883D-96DD-4A32-91C5-2ADA4CA505E7}.Debug.ActiveCfg = Debug|Win32 ! {76C3883D-96DD-4A32-91C5-2ADA4CA505E7}.Debug.Build.0 = Debug|Win32 ! {76C3883D-96DD-4A32-91C5-2ADA4CA505E7}.Release.ActiveCfg = Release|Win32 ! {76C3883D-96DD-4A32-91C5-2ADA4CA505E7}.Release.Build.0 = Release|Win32 EndGlobalSection ! GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection ! GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal --- 1,19 ---- ! Microsoft Visual Studio Solution File, Format Version 9.00 ! # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GCblue", "GCblue.vcproj", "{76C3883D-96DD-4A32-91C5-2ADA4CA505E7}" EndProject Global ! GlobalSection(SolutionConfigurationPlatforms) = preSolution ! Debug|Win32 = Debug|Win32 ! Release|Win32 = Release|Win32 EndGlobalSection ! GlobalSection(ProjectConfigurationPlatforms) = postSolution ! {76C3883D-96DD-4A32-91C5-2ADA4CA505E7}.Debug|Win32.ActiveCfg = Debug|Win32 ! {76C3883D-96DD-4A32-91C5-2ADA4CA505E7}.Debug|Win32.Build.0 = Debug|Win32 ! {76C3883D-96DD-4A32-91C5-2ADA4CA505E7}.Release|Win32.ActiveCfg = Release|Win32 ! {76C3883D-96DD-4A32-91C5-2ADA4CA505E7}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection ! GlobalSection(SolutionProperties) = preSolution ! HideSolutionNode = FALSE EndGlobalSection EndGlobal  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-05-04 22:47:30
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15842a/src/sim Modified Files: Game.cpp tcSimState.cpp Added Files: tcCounterMeasure.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** tcSimState.cpp 21 Apr 2006 23:29:10 -0000 1.97 --- tcSimState.cpp 4 May 2006 22:47:27 -0000 1.98 *************** *** 1924,1928 **** if (iter != captiveObjectMap.end()) { ! wxASSERT(false); fprintf(stderr, "RegisterChildObject - %s already exists in captiveObjectMap\n", name.c_str()); --- 1924,1932 ---- if (iter != captiveObjectMap.end()) { ! wxString msg; ! msg.Printf("Unit name, %s, already exists. Tried to add to parent %s. Fix the scenario file!\n", ! name.c_str(), parent->GetName()); ! wxMessageBox(msg, "Scenario Error", wxICON_ERROR); ! fprintf(stderr, "RegisterChildObject - %s already exists in captiveObjectMap\n", name.c_str()); --- NEW FILE: tcCounterMeasure.cpp --- /** ** @file tcCounterMeasure.cpp */ /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** 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, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" // precompiled header file #include "tcCounterMeasure.h" #include "tcCounterMeasureDBObject.h" #include "tcGenericDBObject.h" #include "tcSensorMap.h" #include "tcSimState.h" #include "tc3DPoint.h" #include "common/tcStream.h" #include "common/tcObjStream.h" #ifdef _DEBUG #define new DEBUG_NEW #endif /** * Load state from update stream */ tcUpdateStream& tcCounterMeasure::operator<<(tcUpdateStream& stream) { tcGameObject::operator<<(stream); return stream; } /** * Save state to update stream */ tcUpdateStream& tcCounterMeasure::operator>>(tcUpdateStream& stream) { tcGameObject::operator>>(stream); return stream; } /** * apply movement restrictions (based on terrain height and altitude normally) */ void tcCounterMeasure::ApplyRestrictions() { // destroy on impact with ground or water if ((mcKin.mfAlt_m <= 0)||(mcTerrain.mfHeight_m >= mcKin.mfAlt_m)) { mfDamageLevel = 1.0f; } } bool tcCounterMeasure::IsChaff() const { return typeCode == tcCounterMeasureDBObject::CM_CHAFF; } bool tcCounterMeasure::IsFlare() const { return typeCode == tcCounterMeasureDBObject::CM_FLARE; } /** * Initializes state for launch from game object. * Adds self to simulation * * @param obj launching game object * @param launcher index of launcher */ void tcCounterMeasure::LaunchFrom(tcGameObject* obj, unsigned nLauncher) { if (tcPlatformObject* platObj = dynamic_cast<tcPlatformObject*>(obj)) { tc3DPoint launcherPos = platObj->mpDBObject->GetLauncherPosition(nLauncher); GeoPoint pos = obj->RelPosToLatLonAlt(launcherPos.x, launcherPos.y, launcherPos.z); mcKin.mfLon_rad = pos.mfLon_rad; mcKin.mfLat_rad = pos.mfLat_rad; mcKin.mfAlt_m = pos.mfAlt_m; } else { mcKin.mfLon_rad = obj->mcKin.mfLon_rad; mcKin.mfLat_rad = obj->mcKin.mfLat_rad; mcKin.mfAlt_m = obj->mcKin.mfAlt_m; } mcKin.mfPitch_rad = 0; mcKin.mfClimbAngle_rad = 0; mcKin.mfSpeed_kts = obj->mcKin.mfSpeed_kts; mcKin.mfHeading_rad = obj->mcKin.mfHeading_rad; if (mcKin.mfAlt_m < 30.0f) mcKin.mfAlt_m = 30.0f; wxString s; if (IsChaff()) { s = wxString::Format("Chaff %d-%d", obj->mnID, rand() % 1000); } else if (IsFlare()) { s = wxString::Format("Flare %d-%d", obj->mnID, rand() % 1000); } mzUnit = s.c_str(); SetAlliance(obj->GetAlliance()); tcSimState* simState = tcSimState::Get(); simState->AddPlatform(static_cast<tcGameObject*>(this)); } void tcCounterMeasure::Move(float dt_s) { float fHeading_rad = mcKin.mfHeading_rad; float fGroundSpeed_kts = mcKin.mfSpeed_kts; double fDistance_rad = fGroundSpeed_kts*dt_s*(float)C_KTSTORADPS; mcKin.mfLon_rad += fDistance_rad*(double)(sinf(fHeading_rad)/cosf((float)mcKin.mfLat_rad)); mcKin.mfLat_rad += (double)cosf(fHeading_rad)*fDistance_rad; mcKin.mfAlt_m += -0.5*dt_s; // use constant downward (slow) velocity for now } void tcCounterMeasure::Update(double t) { float dt_s = (float)(t - mfStatusTime); UpdateSpeed(dt_s); Move(dt_s); ApplyRestrictions(); mfStatusTime = t; } /** * Check for nearby weapons that countermeasure is effective against. * If cone angle to countermeasure is close enough to cone angle to target, * then allow chance of threat switching target to countermeasure. */ void tcCounterMeasure::UpdateSeduction(double t) { float dt_s = (float)(t - lastSeductionUpdate); if (dt_s < mpDBObject->update_s) return; lastSeductionUpdate = t; } void tcCounterMeasure::UpdateSpeed(float dt_s) { if (mcKin.mfSpeed_kts > 0) { mcKin.mfSpeed_kts = mcKin.mfSpeed_kts - 50*dt_s; } else { mcKin.mfSpeed_kts = 0; } } /** * */ tcCounterMeasure::tcCounterMeasure() : mpDBObject(0), lastSeductionUpdate(0), typeCode(0) { } tcCounterMeasure::tcCounterMeasure(const tcCounterMeasure& src) { wxASSERT(false); // not supported } /** * Constructor that initializes using info from database entry. */ tcCounterMeasure::tcCounterMeasure(tcCounterMeasureDBObject* obj) : tcGameObject(obj), mpDBObject(obj), typeCode(obj->typeCode) { } /** * */ tcCounterMeasure::~tcCounterMeasure() { } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** Game.cpp 21 Apr 2006 23:29:09 -0000 1.155 --- Game.cpp 4 May 2006 22:47:27 -0000 1.156 *************** *** 2457,2461 **** if (!mbScenarioEdit) mbPaused = !mbPaused; return; ! case 'A': accelerateTime = (accelerateTime + 1)/2 - 1; --- 2457,2463 ---- if (!mbScenarioEdit) mbPaused = !mbPaused; return; ! case 'r': ! tacticalMap->ActivateCmd(MC_RANGE); ! return; case 'A': accelerateTime = (accelerateTime + 1)/2 - 1;  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-05-04 22:47:30
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15842a/src/graphics Modified Files: tcGameView.cpp tcMapView.cpp tcPlatformGui.cpp Added Files: tcMPGameView.cpp Log Message: Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** tcMapView.cpp 23 Mar 2006 01:11:02 -0000 1.44 --- tcMapView.cpp 4 May 2006 22:47:26 -0000 1.45 *************** *** 2,6 **** ** @file tcMapView.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tcMapView.cpp */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 31,34 **** --- 31,35 ---- #include "aerror.h" #include "mapsymbols.h" + #include "nsNav.h" #include "simmath.h" #include "tcSound.h" // this causes tcTacticalMapView to vanish from class browser in some positions !? *************** *** 175,178 **** --- 176,188 ---- return pscreen; } + + tcPoint tcMapView::GeoToScreen(double afLon, double afLat) + { + tcPoint pscreen; + pscreen.x = (afLon - mfLonCenter)*mfScaleX_pelprad + mnXCenter; + pscreen.y = (-afLat + mfLatCenter)*mfScaleY_pelprad + mnYCenter; + return pscreen; + } + /***********************************************************************************/ float tcMapView::GeoExtentToScreen(float afExtent_rad) *************** *** 277,291 **** void tcMapView::SetView(tcPoint center, float afLonSpan) { - float fLatSpan; - float fMaxLonSpan, fMaxLatSpan; - tcGeoRect newview; - if (center.x < -C_PI) {center.x += C_TWOPI;} else if (center.x >= C_PI) {center.x -= C_TWOPI;} ! fMaxLonSpan = mrectViewBounds.Width(); ! fMaxLatSpan = mrectViewBounds.Height(); if (afLonSpan > fMaxLonSpan) {afLonSpan = fMaxLonSpan;} ! fLatSpan = afLonSpan*mnHeight/mnWidth; if (fLatSpan > fMaxLatSpan) { --- 287,297 ---- void tcMapView::SetView(tcPoint center, float afLonSpan) { if (center.x < -C_PI) {center.x += C_TWOPI;} else if (center.x >= C_PI) {center.x -= C_TWOPI;} ! float fMaxLonSpan = mrectViewBounds.Width(); ! float fMaxLatSpan = mrectViewBounds.Height(); if (afLonSpan > fMaxLonSpan) {afLonSpan = fMaxLonSpan;} ! float fLatSpan = afLonSpan*mnHeight/mnWidth; if (fLatSpan > fMaxLatSpan) { *************** *** 293,297 **** --- 299,311 ---- afLonSpan = fLatSpan*mnWidth/mnHeight; } + + float minLatSpan = 100.0f * C_MTORAD; // limit zoom to 100 m over height of view + if (fLatSpan < minLatSpan) + { + fLatSpan = minLatSpan; + afLonSpan = fLatSpan*mnWidth/mnHeight; + } + tcGeoRect newview; newview.Set(center.x - 0.5f*afLonSpan, center.x + 0.5f*afLonSpan, center.y - 0.5f*fLatSpan, center.y + 0.5f*fLatSpan); *************** *** 364,374 **** tcMapView::~tcMapView() { ! /* ! if (mpPen != NULL) {delete mpPen;} ! if (mpPenThin != NULL) {delete mpPenThin;} ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontSmall != NULL) {delete mpFontSmall;} ! if (mpBrush != NULL) {delete mpBrush;} ! */ } --- 378,382 ---- tcMapView::~tcMapView() { ! } *************** *** 377,381 **** --- 385,401 ---- /**************************************************************/ + void tcTacticalMapView::ActivateCmd(teMapCmdType aeCmd) + { + mbMapCmdActive = true; + meMapCmd = aeCmd; + + mapCommandStartLocation = mpointMouse; + } + void tcTacticalMapView::DeactivateCmd() + { + mbMapCmdActive = false; + meMapCmd = MC_NONE; + } /** *************** *** 407,411 **** if (mfGridSize_rad == 0) {return;} ! osg::Vec4 color(0.69, 0.69, 0.69, 1.0); // change this to set range based on what will cover the screen as well --- 427,431 ---- if (mfGridSize_rad == 0) {return;} ! osg::Vec4 color(0.69, 0.69, 0.69, 0.5); // change this to set range based on what will cover the screen as well *************** *** 546,549 **** --- 566,572 ---- DrawLineR(x-8, y+8, x+8, y-8, color); break; + case MC_RANGE: + DrawMapCmdRange(); + break; default: break; *************** *** 552,555 **** --- 575,632 ---- /** + * Draw circle (ellipse on screen) of constant range. If no object is hooked, center is + * the mouse position when command was activated. Otherwise the center is the location of + * the hooked object. Heading and range are relative to current mouse position. + */ + void tcTacticalMapView::DrawMapCmdRange() + { + bool isObjectHooked = hookedId.size() > 0; + tcPoint pCenter; + tcPoint screenCenter; // in screen coordinates + if (isObjectHooked) + { + pCenter.x = mfHookLon; + pCenter.y = mfHookLat; + screenCenter = GeoToScreen(pCenter); + } + else + { + pCenter = ScreenToGeo(mapCommandStartLocation); + screenCenter.x = float(mapCommandStartLocation.x); + screenCenter.y = float(mapCommandStartLocation.y); + } + + tcPoint pCurrent = ScreenToGeo(mpointMouse); + float range_rad = nsNav::GCDistanceApprox_rad(pCenter.y, pCenter.x, pCurrent.y, pCurrent.x); + float bearing_rad = nsNav::GCHeadingApprox_rad(pCenter.y, pCenter.x, pCurrent.y, pCurrent.x); + if (bearing_rad < 0) bearing_rad += C_TWOPI; // force 0 - 360 format + + float ellipseHeight = GeoExtentToScreen(2.0f * range_rad); + float ellipseWidth = GeoExtentToScreen(2.0f * range_rad / cosf(pCenter.y)); + + // draw ellipse from center passing through current with latitude based eccentricity + osg::Vec4 lineColor(1.0f, 1.0f, 1.0f, 0.8f); + osg::Geometry* rangeCircle = CreatePieGeometry(ellipseWidth, ellipseHeight, -180, 180, lineColor, FILL_OFF); + DrawGeometryR(rangeCircle, screenCenter.x, screenCenter.y); + + // draw line from center to current + DrawLineR(screenCenter.x, screenCenter.y, mpointMouse.x, mpointMouse.y, lineColor); + + // draw text with range and bearing info + osg::Vec4 fontColor(1.0f, 1.0f, 1.0f, 0.9f); + float range_km = C_RADTOKM * range_rad; + wxString s; + s.Printf("%.0f km %.0f deg", range_km, C_180OVERPI * bearing_rad); + + // draw text halfway between center and current mouse pos + float xtext = 0.5f * (screenCenter.x + float(mpointMouse.x)); + float ytext = 0.5f * (screenCenter.y + float(mpointMouse.y)); + + DrawTextR(s.c_str(), xtext, ytext, + defaultFont.get(), fontColor, 12.0, CENTER_CENTER); + + } + + /** * */ *************** *** 671,675 **** /*** Draw grid ***/ ! //DrawGrid(); // disabled until the terrain view graphics are ported to OSG /*** Draw scale bar ***/ --- 748,752 ---- /*** Draw grid ***/ ! DrawGrid(); // disabled until the terrain view graphics are ported to OSG /*** Draw scale bar ***/ *************** *** 851,854 **** --- 928,936 ---- } + bool tcTacticalMapView::IsMapCmdActive() const + { + return mbMapCmdActive != 0; + } + /** * Creates default osg::Geometry object for symbol *************** *** 1752,1756 **** pMO->mbFocus = (IsHooked(pMO->mnID)) && (type != SYMBOL_SENSOR); ! if (mbMapCmdActive && (pMO->mbFocus) && (IsFirstHook(pMO->mnID))) { mfHookLat = pMO->mfLat; // refactor --- 1834,1838 ---- pMO->mbFocus = (IsHooked(pMO->mnID)) && (type != SYMBOL_SENSOR); ! if (pMO->mbFocus && IsFirstHook(pMO->mnID)) { mfHookLat = pMO->mfLat; // refactor *************** *** 2293,2297 **** long mnID; ! if (mpCommandInterface == NULL) {return;} switch (meMapCmd) --- 2375,2379 ---- long mnID; ! if (mpCommandInterface == 0) return; switch (meMapCmd) *************** *** 2328,2331 **** --- 2410,2414 ---- break; default: + meMapCmd = MC_NONE; mbMapCmdActive = false; break; *************** *** 2573,2587 **** void tcTacticalMapView::OnMouseWheel(wxMouseEvent& event) { ! wxPoint point(mnXCenter, mnYCenter); // zoom on center regardless of pointer pos int zDelta = event.GetWheelRotation(); if (zDelta > 0) { ! SetViewCenterZoom(point,2.0f); tcSound::Get()->PlayEffect("Beep2"); } else if (zDelta < 0) { ! SetViewCenterZoom(point,0.5f); tcSound::Get()->PlayEffect("Beep2"); } --- 2656,2683 ---- void tcTacticalMapView::OnMouseWheel(wxMouseEvent& event) { ! // if object is hooked zoom on that position, otherwise zoom on center ! wxPoint zoomPoint; ! if (hookedId.size() > 0) ! { ! tcPoint hookScreen = GeoToScreen(mfHookLon, mfHookLat); ! zoomPoint.x = int(hookScreen.x); ! zoomPoint.y = int(hookScreen.y); ! } ! else ! { ! zoomPoint.x = mnXCenter; ! zoomPoint.y = mnYCenter; ! } ! int zDelta = event.GetWheelRotation(); if (zDelta > 0) { ! SetViewCenterZoom(zoomPoint, 2.0f); tcSound::Get()->PlayEffect("Beep2"); } else if (zDelta < 0) { ! SetViewCenterZoom(zoomPoint, 0.5f); tcSound::Get()->PlayEffect("Beep2"); } *************** *** 2706,2710 **** scrollActive(false), lastScrollTime(0), ! scrollDirection(0.0) { --- 2802,2808 ---- scrollActive(false), lastScrollTime(0), ! scrollDirection(0.0), ! mfHookLat(0), ! mfHookLon(0) { Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcGameView.cpp 23 Mar 2006 01:11:02 -0000 1.18 --- tcGameView.cpp 4 May 2006 22:47:26 -0000 1.19 *************** *** 1,6 **** /* ! ** tcGameView.cpp ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 1,6 ---- /* ! ** @file tcGameView.cpp ! */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 148,153 **** { GeoPoint pcurrent; ! pcurrent.mfLon_rad = (float)platformObj->mcKin.mfLon_rad; ! pcurrent.mfLat_rad = (float)platformObj->mcKin.mfLat_rad; pcurrent.mfAlt_m = platformObj->mcKin.mfAlt_m; navpoints.push_back(pcurrent); // add current position --- 148,153 ---- { GeoPoint pcurrent; ! pcurrent.mfLon_rad = platformObj->mcKin.mfLon_rad; ! pcurrent.mfLat_rad = platformObj->mcKin.mfLat_rad; pcurrent.mfAlt_m = platformObj->mcKin.mfAlt_m; navpoints.push_back(pcurrent); // add current position *************** *** 625,630 **** 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; mpMapView->maMapObj[rnIndex].mnColor = 0; --- 625,630 ---- mpMapView->maMapObj[rnIndex].meSymbol = GetMapSymbolByClassification(pdata->mnType); mpMapView->maMapObj[rnIndex].meAffiliation = aeAffiliation; ! mpMapView->maMapObj[rnIndex].mfLon = po->mcKin.mfLon_rad; ! mpMapView->maMapObj[rnIndex].mfLat = po->mcKin.mfLat_rad; mpMapView->maMapObj[rnIndex].mnID = po->mnID; mpMapView->maMapObj[rnIndex].mnColor = 0; *************** *** 655,660 **** mpWorldMapView->maMapObj[rnWorldIdx].mbExists = 1; mpWorldMapView->maMapObj[rnWorldIdx].mnColor = nColor; ! mpWorldMapView->maMapObj[rnWorldIdx].mfLon = (float)po->mcKin.mfLon_rad; ! mpWorldMapView->maMapObj[rnWorldIdx].mfLat = (float)po->mcKin.mfLat_rad; mpWorldMapView->maMapObj[rnWorldIdx].mnID = po->mnID; mpWorldMapView->maMapObj[rnWorldIdx].meAffiliation = aeAffiliation; --- 655,660 ---- mpWorldMapView->maMapObj[rnWorldIdx].mbExists = 1; mpWorldMapView->maMapObj[rnWorldIdx].mnColor = nColor; ! mpWorldMapView->maMapObj[rnWorldIdx].mfLon = po->mcKin.mfLon_rad; ! mpWorldMapView->maMapObj[rnWorldIdx].mfLat = po->mcKin.mfLat_rad; mpWorldMapView->maMapObj[rnWorldIdx].mnID = po->mnID; mpWorldMapView->maMapObj[rnWorldIdx].meAffiliation = aeAffiliation; Index: tcPlatformGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcPlatformGui.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcPlatformGui.cpp 23 Mar 2006 01:11:02 -0000 1.8 --- tcPlatformGui.cpp 4 May 2006 22:47:26 -0000 1.9 *************** *** 69,73 **** item->SetIcon(icon); ! item->SetId(child->mnKey); std::string itemName = child->mzClass.mz; --- 69,77 ---- item->SetIcon(icon); ! /* Changed to make id unique within platform gui so that ! ** correct item is unloaded. May have bad side effects. ! */ ! long itemId = (child->mnKey << 8) + launcherIdx; ! item->SetId(itemId); std::string itemName = child->mzClass.mz; --- NEW FILE: tcMPGameView.cpp --- /** ** @file tcMPGameView.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcMPGameView.h" #include "tcButton.h" #include "tcEditBox.h" #include "tcConsoleBox.h" #include "common/tinyxml.h" #include "network/tcMultiplayerInterface.h" #include "wxcommands.h" #include "tcSimState.h" #include "common/tcOptions.h" #include "tcUserInfo.h" BEGIN_EVENT_TABLE(tcMPGameView, tcXmlWindow) EVT_COMMAND(2, wxEVT_COMMAND_TEXT_UPDATED, tcMPGameView::SendChatText) END_EVENT_TABLE() #ifdef _DEBUG #define new DEBUG_NEW #endif using network::tcMultiplayerInterface; void tcMPGameView::Draw() { DrawChildren(); HideUnusedObjects(); } void tcMPGameView::OnLButtonDown(wxMouseEvent& event) { } /** * Send chat text to all connections */ void tcMPGameView::SendChatText(wxCommandEvent& event) { tcMultiplayerInterface* multiplayerInterface = tcMultiplayerInterface::Get(); bool isServer = multiplayerInterface->IsServer(); std::string chatText = event.GetString().c_str(); if (isServer && (multiplayerInterface->IsCommand(chatText))) { chatBox->Print(chatText.c_str()); multiplayerInterface->ProcessCommandServer(chatText); return; } /* prepend name tag if server, this is done for clients by server, server has ** to do tagging itself */ if (isServer) { chatText = std::string("<") + multiplayerInterface->GetName() + std::string("> ") + chatText; } tcMultiplayerInterface::Get()->BroadcastChatText(chatText); // if server, print chat text locally since no echo comes back if (isServer) { chatBox->Print(chatText.c_str()); } } /** * @param surfaceHost tcWindow to share surface of */ tcMPGameView::tcMPGameView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : tcXmlWindow(parent, pos, size, "xml/mpgame_view.xml", name) { LoadBackgroundImage("background.jpg"); if (config) { // AddXMLControls(); } else { fprintf(stderr, "tcMPGameView::tcMPGameView - NULL xml config node\n"); return; } TiXmlNode* root = config->FirstChild("Window"); if (!root) { fprintf(stderr, "tcMPGameView::tcMPGameView - Missing top level <Window> tag\n"); return; } // add chat text console TiXmlNode* current = root->FirstChild("ChatBox"); chatBox = new tcConsoleBox(this, current); chatBox->SetBackgroundColor(osg::Vec4(0, 0, 0, 1)); chatBox->SetBackgroundDraw(true); chatBox->SetActive(true); tcMultiplayerInterface::Get()->AddChatSubscriber(chatBox); // add chat text edit box current = root->FirstChild("ChatEntry"); chatEntry = new tcEditBox(this, current); chatEntry->SetActive(true); chatEntry->SetCommand(2); chatEntry->SetClearOnReturn(true); chatEntry->SetBuffer(""); } tcMPGameView::~tcMPGameView() { }  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-05-04 22:47:29
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15842a/src/database Added Files: tcCounterMeasureDBObject.cpp Log Message: --- NEW FILE: tcCounterMeasureDBObject.cpp --- /** ** @file tcCounterMeasureDBObject.cpp */ /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** 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, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" //#if _MSC_VER > 1000 //#pragma warning(disable:4786) // suppress warning for STL bug in VC6, see Q167355 in the MSDN Library. //#endif // _MSC_VER > 1000 #include "tcCounterMeasureDBObject.h" #include "math_constants.h" #include "randfn.h" #include "CsvTranslator.h" #include "common/tinyxml.h" #include "database/tcSqlReader.h" #include <sstream> #ifdef _DEBUG #define new DEBUG_NEW #endif namespace database { /** * workaround for write serialization issue * @return true if db obj is a leaf obj */ bool tcCounterMeasureDBObject::IsLeaf() const { return mnClassID == DTYPE_CM; } void tcCounterMeasureDBObject::PrintToFile(tcFile& file) { char zBuff[128]; tcDatabaseObject::PrintToFile(file); sprintf(zBuff," CM: No data yet \n"); file.WriteString(zBuff); } int tcCounterMeasureDBObject::Serialize(tcFile& file, bool mbLoad, UINT32 anVersion) { wxASSERT(false); // not implemented tcDatabaseObject::Serialize(file,mbLoad,anVersion); if (mbLoad) { } else { } return true; } int tcCounterMeasureDBObject::SerializeCSV(CsvTranslator *csv, bool mbLoad) { wxASSERT(false); // not implemented tcDatabaseObject::SerializeCSV(csv, mbLoad); if (mbLoad) { } else { // csv->WriteLine(); // do not writeline since this isn't a leaf class } return 1; } /** * Loads/saves XML data for database object * @param load true to load, false to save */ void tcCounterMeasureDBObject::SerializeXml(TiXmlElement* node, bool load) { if (load) return; // write only for now wxASSERT(node); //TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("cm"))->ToElement(); wxASSERT(false); // not implemented tcDatabaseObject::SerializeXml(node, load); } int tcCounterMeasureDBObject::WriteCSVHeader(database::CsvTranslator *csv) { tcDatabaseObject::WriteCSVHeader(csv); wxASSERT(false); // not implemented return 1; } /** * Adds sql column definitions to columnString. This is used for * SQL create table command */ void tcCounterMeasureDBObject::AddSqlColumns(std::string& columnString) { tcDatabaseObject::AddSqlColumns(columnString); columnString += ","; columnString += "TypeCode number(5),"; columnString += "EffectivenessFlags number(5),"; columnString += "Range_km number(5),"; columnString += "Update_s number(5),"; columnString += "Ps number(5),"; columnString += "LifeSpan_s number(5)"; } void tcCounterMeasureDBObject::ReadSql(tcSqlReader& entry) { tcDatabaseObject::ReadSql(entry); typeCode = entry.GetInt("TypeCode"); effectivenessFlags = entry.GetInt("EffectivenessFlags"); range_km = entry.GetDouble("Range_km"); update_s = entry.GetDouble("Update_s"); ps = entry.GetDouble("Ps"); lifeSpan_s = entry.GetDouble("LifeSpan_s"); } void tcCounterMeasureDBObject::WriteSql(std::string& valueString) { tcDatabaseObject::WriteSql(valueString); std::stringstream s; s << ","; s << typeCode << ","; s << effectivenessFlags << ","; s << range_km << ","; s << update_s << ","; s << ps << ","; s << lifeSpan_s; valueString += s.str(); } tcCounterMeasureDBObject::tcCounterMeasureDBObject() : tcDatabaseObject(), typeCode(0), effectivenessFlags(0), range_km(0), update_s(99.0f), ps(0), lifeSpan_s(0) { mzClass = "Default CM"; mnClassID = DTYPE_CM; } tcCounterMeasureDBObject::tcCounterMeasureDBObject(const tcCounterMeasureDBObject& obj) : tcDatabaseObject(obj), typeCode(obj.typeCode), effectivenessFlags(obj.effectivenessFlags), range_km(obj.range_km), update_s(obj.update_s), ps(obj.ps), lifeSpan_s(obj.lifeSpan_s) { mnClassID = DTYPE_CM; } tcCounterMeasureDBObject::~tcCounterMeasureDBObject() { } }  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-05-04 22:47:29
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15842a/src/common Modified Files: nsNav.cpp simmath.cpp Log Message: Index: nsNav.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/nsNav.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nsNav.cpp 23 Mar 2006 01:11:01 -0000 1.9 --- nsNav.cpp 4 May 2006 22:47:26 -0000 1.10 *************** *** 188,191 **** --- 188,192 ---- b.mfLon_rad = a.mfLon_rad + sinf(afHeading_rad)*afRange_rad/cosf(a.mfLat_rad); } + /** * Calculates offset point from (afLatA_rad,afLonA_rad). *************** *** 203,206 **** --- 204,224 ---- afLonB_rad = afLonA_rad + sinf(afHeading_rad)*afRange_rad/cosf(afLatA_rad); } + + /** + * Calculates offset point from (afLatA_rad,afLonA_rad). + * @param afLatA_rad starting latitude in radians. + * @param afLonA_rad starting longitude in radians. + * @param afLatB_rad offset latitude in radians. + * @param afLonB_rad offset longitude in radians. + * @param afHeading_rad offset heading in radians. + * @param afRange_rad offset range in radians at equator. + */ + void nsNav::OffsetApprox(double afLatA_rad, double afLonA_rad, + double& afLatB_rad, double& afLonB_rad, float afHeading_rad, double afRange_rad) + { + afLatB_rad = afLatA_rad + cosf(afHeading_rad)*afRange_rad; + afLonB_rad = afLonA_rad + sinf(afHeading_rad)*afRange_rad/cosf(afLatA_rad); + } + /** * @return latitude of point at afLon_rad along GC path between a and b Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** simmath.cpp 23 Mar 2006 01:11:01 -0000 1.30 --- simmath.cpp 4 May 2006 22:47:26 -0000 1.31 *************** *** 850,858 **** } ! // set rpGeoPoint to point at afBearing_deg and afRange_km relative to ! // current location of this tcKinematics object ! // altitude isn't changed, has issues off of equator like everything else :< void tcKinematics::SetRelativeGeo(GeoPoint& rpGeoPoint, float afBearing_rad, float afRange_km) { ! nsNav::OffsetApprox((float)mfLat_rad,(float)mfLon_rad, rpGeoPoint.mfLat_rad, rpGeoPoint.mfLon_rad, afBearing_rad,afRange_km*C_KMTORAD); } --- 850,860 ---- } ! /** ! * Set rpGeoPoint to point at afBearing_deg and afRange_km relative to ! * current location of this tcKinematics object ! * altitude isn't changed, has issues off of equator like everything else :< ! */ void tcKinematics::SetRelativeGeo(GeoPoint& rpGeoPoint, float afBearing_rad, float afRange_km) { ! nsNav::OffsetApprox(mfLat_rad, mfLon_rad, rpGeoPoint.mfLat_rad, rpGeoPoint.mfLon_rad, afBearing_rad,afRange_km*C_KMTORAD); }  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-05-04 22:47:12
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15744/include/database Added Files: tcCounterMeasureDBObject.h Log Message: --- NEW FILE: tcCounterMeasureDBObject.h --- /** ** @file tcCounterMeasureDBObject.h */ /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** 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, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COUNTERMEASUREDBOBJECT_H_ #define _COUNTERMEASUREDBOBJECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "tcDatabaseObject.h" class TiXmlElement; namespace database { class tcSqlReader; /** * Database object to support simple countermeasure model */ class tcCounterMeasureDBObject : public tcDatabaseObject { public: enum { CM_OPTICAL = 1, ///< non-IR optical CM_IR = 2, ///< IR optical CM_RADAR = 4, CM_ESM = 8, CM_SONAR_ACTIVE = 16, CM_SONAR_PASSIVE = 32 }; enum { CM_CHAFF = 1, CM_FLARE = 2 }; int typeCode; ///< type of countermeasure (CM) int effectivenessFlags; ///< sensors that CM is effective against float range_km; ///< range that countermeasure can seduce threats float update_s; ///< update interval for seduction attempts float ps; ///< 0-1, probability that CM can seduce threat each attempt float lifeSpan_s; ///< duration that CM is active virtual const char* GetClassName() {return "CounterMeasure";} ///< returns class name of database object bool IsLeaf() const; ///< returns true if db obj is a leaf obj virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); int SerializeCSV(CsvTranslator* csv, bool mbLoad); ///< CSV serialization virtual void SerializeXml(TiXmlElement* node, bool load); ///< XML serialization static int WriteCSVHeader(CsvTranslator* csv); ///< writes column headings static void AddSqlColumns(std::string& columnString); void ReadSql(tcSqlReader& entry); void WriteSql(std::string& valueString); protected: tcCounterMeasureDBObject(); tcCounterMeasureDBObject(const tcCounterMeasureDBObject& obj); virtual ~tcCounterMeasureDBObject(); }; } // namespace database #endif  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-05-04 22:47:11
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15744/include/common Modified Files: nsNav.h simmath.h Log Message: Index: nsNav.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/nsNav.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nsNav.h 22 Mar 2006 01:23:28 -0000 1.9 --- nsNav.h 4 May 2006 22:47:06 -0000 1.10 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file nsNav.h ! */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 47,54 **** static void Offset(const tsGeoPointRad& a, tsGeoPointRad& b, float afHeading_rad, float afRange_rad); static void OffsetApprox(const tsGeoPointRad& a, tsGeoPointRad& b, float afHeading_rad, float afRange_rad); static void OffsetApprox(float afLatA_rad, float afLonA_rad, - float& afLatB_rad, float& afLonB_rad, float afHeading_rad, float afRange_rad); static float GetLatAlongGCPath(tsGeoPointRad a, tsGeoPointRad b, float afLon_rad); static void Test(); --- 49,61 ---- static void Offset(const tsGeoPointRad& a, tsGeoPointRad& b, float afHeading_rad, float afRange_rad); + static void OffsetApprox(const tsGeoPointRad& a, tsGeoPointRad& b, float afHeading_rad, float afRange_rad); + static void OffsetApprox(float afLatA_rad, float afLonA_rad, + float& afLatB_rad, float& afLonB_rad, float afHeading_rad, float afRange_rad); + + static void OffsetApprox(double afLatA_rad, double afLonA_rad, + double& afLatB_rad, double& afLonB_rad, float afHeading_rad, double afRange_rad); static float GetLatAlongGCPath(tsGeoPointRad a, tsGeoPointRad b, float afLon_rad); static void Test(); Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** simmath.h 22 Mar 2006 01:23:28 -0000 1.34 --- simmath.h 4 May 2006 22:47:06 -0000 1.35 *************** *** 1,4 **** --- 1,5 ---- /** ** @file simmath.h + ** ** This file (and simmath.cpp) needs to be broken up into separate ** file for better modularity. *************** *** 158,163 **** { public: ! float mfLon_rad; ! float mfLat_rad; float mfAlt_m; void Set(float x,float y) {mfLon_rad=x;mfLat_rad=y;} --- 159,164 ---- { public: ! double mfLon_rad; ! double mfLat_rad; float mfAlt_m; void Set(float x,float y) {mfLon_rad=x;mfLat_rad=y;}  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-05-04 22:47:11
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15744/include/sim Added Files: tcCounterMeasure.h Log Message: --- NEW FILE: tcCounterMeasure.h --- /** ** @file tcCounterMeasure.h */ /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** 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, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #if _MSC_VER > 1000 #pragma once #endif #ifndef _TCCOUNTERMEASURE_H_ #define _TCCOUNTERMEASURE_H_ #include "tcGameObject.h" class tcStream; class tcUpdateStream; namespace database { class tcCounterMeasureDBObject; } /** * Class for countermeasures such as chaff, flares, decoys, noisemakers */ class tcCounterMeasure : public tcGameObject { public: protected: tcCounterMeasureDBObject* mpDBObject; void LaunchFrom(tcGameObject* obj, unsigned nLauncher); virtual void Update(double t); virtual tcUpdateStream& operator<<(tcUpdateStream& stream); virtual tcUpdateStream& operator>>(tcUpdateStream& stream); tcCounterMeasure(); tcCounterMeasure(const tcCounterMeasure& src); tcCounterMeasure(tcCounterMeasureDBObject* obj); virtual ~tcCounterMeasure(); private: double lastSeductionUpdate; int typeCode; void ApplyRestrictions(); bool IsChaff() const; bool IsFlare() const; void Move(float dt_s); void UpdateSeduction(double t); void UpdateSpeed(float dt_s); }; #endif  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-05-04 22:47:11
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15744/include/graphics Modified Files: tcMapView.h Added Files: tcMPGameView.h Log Message: --- NEW FILE: tcMPGameView.h --- /** ** @file tcMPGameView.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MPGAMEVIEW_H_ #define _MPGAMEVIEW_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "tcXmlWindow.h" class tcEditBox; class tcConsoleBox; /** * User interface window for multiplayer game management. * This window is displayed after connecting to a server, allowing * teams and game settings to be defined. */ class tcMPGameView : public tcXmlWindow { struct PlayerInfo { std::string name; bool isCommander; }; struct TeamInfo { std::string name; std::vector<PlayerInfo> playerList; }; public: void Draw(); void OnLButtonDown(wxMouseEvent& event); void SendChatText(wxCommandEvent& event); tcMPGameView(wxWindow* parent, const wxPoint& pos, const wxSize& size, const wxString& name = "MPGameView"); virtual ~tcMPGameView(); private: tcConsoleBox* chatBox; tcEditBox* chatEntry; std::vector<TeamInfo> teamList; DECLARE_EVENT_TABLE() }; #endif Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcMapView.h 22 Mar 2006 01:23:29 -0000 1.28 --- tcMapView.h 4 May 2006 22:47:06 -0000 1.29 *************** *** 91,95 **** unsigned int mnColor; ///< ARGB (ABGR?) color float mfHeading; ! float mfLon,mfLat; teSymbol meSymbol; teAffiliation meAffiliation; --- 91,95 ---- unsigned int mnColor; ///< ARGB (ABGR?) color float mfHeading; ! double mfLon,mfLat; teSymbol meSymbol; teAffiliation meAffiliation; *************** *** 130,134 **** MC_HEADING, MC_TARGET, ! MC_DATUM }; --- 130,135 ---- MC_HEADING, MC_TARGET, ! MC_DATUM, ! MC_RANGE // draw range circle }; *************** *** 191,194 **** --- 192,196 ---- tcPoint GeoToScreen(tcPoint pgeo); tcPoint GeoToScreen(float afLon, float afLat); + tcPoint GeoToScreen(double afLon, double afLat); float GeoExtentToScreen(float afExtent_rad); osg::Vec4 GetAffiliationColor(teAffiliation a); *************** *** 259,262 **** --- 261,265 ---- wxPoint mpointMouse; ///< current location of mouse cursor tcPoint mpointGeoDatum; ///< for MC_DATUM map command to store user-selected location + wxPoint mapCommandStartLocation; ///< for MC_RANGE map command, initial position of mouse float mfMapCmdHeading; long mnMapCmdTarget; *************** *** 289,292 **** --- 292,296 ---- void DrawTerrainText(); void DrawMapCmd(tcMapObj *pMO, teMapCmdType type); + void DrawMapCmdRange(); void DrawNavPoints(); void DrawIndicator(int anType); *************** *** 302,306 **** bool IsFirstHook(long id); bool IsHooked(long id); ! bool IsMapCmdActive() {return meMapCmd != MC_NONE;} void OnChar(wxKeyEvent& event); void OnLeaveWindow(wxMouseEvent& event); --- 306,310 ---- bool IsFirstHook(long id); bool IsHooked(long id); ! bool IsMapCmdActive() const; void OnChar(wxKeyEvent& event); void OnLeaveWindow(wxMouseEvent& event); *************** *** 314,319 **** void OnSize(wxSizeEvent& event); void Refresh(); ! void ActivateCmd(teMapCmdType aeCmd) {mbMapCmdActive=true; meMapCmd=aeCmd;} ! void DeactivateCmd() {mbMapCmdActive=false; meMapCmd=MC_NONE;} void ClearMapObjects(); void Init(); --- 318,323 ---- void OnSize(wxSizeEvent& event); void Refresh(); ! void ActivateCmd(teMapCmdType aeCmd); ! void DeactivateCmd(); void ClearMapObjects(); void Init();  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:29:40
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/src/database Modified Files: tcLauncherDBObject.cpp Log Message: Index: tcLauncherDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcLauncherDBObject.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcLauncherDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.18 --- tcLauncherDBObject.cpp 21 Apr 2006 23:29:07 -0000 1.19 *************** *** 74,77 **** --- 74,98 ---- } + const wxString& tcLauncherDBObject::GetConfigurationDescription() const + { + static wxString description; + + description = ""; + + size_t nConfigs = GetNumberConfigurations(); + + for (size_t n=0; n<nConfigs; n++) + { + description.Printf("%s %d x %s", description.c_str(), + GetConfigurationCapacity(n), GetConfigurationClass(n).c_str()); + if (n < nConfigs - 1) + { + description.Append(","); + } + } + + return description; + } + unsigned int tcLauncherDBObject::GetNumberConfigurations() const {  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:29:14
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/src/sim Modified Files: Game.cpp tcGameObject.cpp tcSimState.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** tcSimState.cpp 26 Mar 2006 00:32:15 -0000 1.96 --- tcSimState.cpp 21 Apr 2006 23:29:10 -0000 1.97 *************** *** 1913,1916 **** --- 1913,1955 ---- /** + * Call when adding child object, e.g. aircraft to flightdeck. + * This allows child object to be looked up by name (but not id) during scenario creation + */ + void tcSimState::RegisterChildObject(const std::string& name, tcGameObject* parent) + { + wxASSERT(parent != 0); + + std::map<std::string, long>::iterator iter = + captiveObjectMap.find(name); + if (iter != captiveObjectMap.end()) + { + wxASSERT(false); + fprintf(stderr, "RegisterChildObject - %s already exists in captiveObjectMap\n", + name.c_str()); + return; + } + + captiveObjectMap[name] = parent->mnID; + } + + /** + * Call when removing child object, e.g. launching aircraft from flightdeck + */ + void tcSimState::UnregisterChildObject(const std::string& name) + { + std::map<std::string, long>::iterator iter = + captiveObjectMap.find(name); + if (iter == captiveObjectMap.end()) + { + wxASSERT(false); + fprintf(stderr, "UnregisterChildObject - %s does not exist in captiveObjectMap\n", + name.c_str()); + return; + } + + captiveObjectMap.erase(iter); + } + + /** * */ *************** *** 2167,2171 **** /** ! * @return game object matching unitName or NULL if not found. */ tcGameObject* tcSimState::GetObjectByName(const std::string& unitName) --- 2206,2210 ---- /** ! * @return game object matching unitName or 0 if not found. */ tcGameObject* tcSimState::GetObjectByName(const std::string& unitName) *************** *** 2173,2204 **** // first try to lookup in map std::map<std::string, long>::iterator iter = objectNameMap.find(unitName); ! if (iter == objectNameMap.end()) return 0; ! ! if (tcGameObject *obj = GetObject(iter->second)) ! { ! return obj; ! } ! else // object doesnt exist, clear map entry { ! objectNameMap.erase(iter); ! return 0; } ! ! /* ! tnPoolIndex pos = maPlatformState.GetStartPosition(); ! tnPoolIndex nSize = maPlatformState.GetCount(); ! tnPoolIndex nKey; ! ! for (int i=0;i<nSize;i++) { ! maPlatformState.GetNextAssoc(pos,nKey,obj); ! wxASSERT(obj); ! if (unitName == obj->mzUnit.mz) { ! return obj; } } ! return NULL; ! */ } --- 2212,2251 ---- // first try to lookup in map std::map<std::string, long>::iterator iter = objectNameMap.find(unitName); ! if (iter != objectNameMap.end()) { ! if (tcGameObject *obj = GetObject(iter->second)) ! { ! return obj; ! } ! else // object doesnt exist any more, clear map entry ! { ! wxASSERT(false); ! objectNameMap.erase(iter); ! return 0; ! } } ! else // check captiveObjectMap to see if this is a flightdeck object { ! std::map<std::string, long>::iterator iter = captiveObjectMap.find(unitName); ! if (iter != captiveObjectMap.end()) { ! tcGameObject* parent = GetObject(iter->second); ! if (parent != 0) ! { ! return parent->GetChildByName(unitName); ! } ! else ! { ! wxASSERT(false); ! captiveObjectMap.erase(iter); ! return 0; ! } ! } ! else ! { ! return 0; } } ! } *************** *** 2823,2826 **** --- 2870,2874 ---- objectNameMap.clear(); + captiveObjectMap.clear(); } Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** tcGameObject.cpp 26 Mar 2006 00:32:15 -0000 1.43 --- tcGameObject.cpp 21 Apr 2006 23:29:10 -0000 1.44 *************** *** 118,122 **** * */ ! void tcGameObject::ClearChildren(void) { { --- 118,122 ---- * */ ! void tcGameObject::ClearChildren() { { *************** *** 124,131 **** for (size_t i=0;i<child_count;i++) { ! tcGameObject *pGameObj = children.at(i); ! if (pGameObj != NULL) { ! delete pGameObj; } } --- 124,132 ---- for (size_t i=0;i<child_count;i++) { ! tcGameObject* child = children.at(i); ! if (child != 0) { ! simState->UnregisterChildObject(child->GetName()); ! delete child; } } *************** *** 136,143 **** for (size_t i=0;i<launch_count;i++) { ! tcGameObject *pGameObj = toLaunch.at(i); ! if (pGameObj != NULL) { ! delete pGameObj; } } --- 137,144 ---- for (size_t i=0;i<launch_count;i++) { ! tcGameObject* gameObj = toLaunch.at(i); ! if (gameObj != 0) { ! delete gameObj; } } *************** *** 436,439 **** --- 437,442 ---- child->parent = this; children.push_back(child); + + simState->RegisterChildObject(child->GetName(), this); } *************** *** 456,459 **** --- 459,502 ---- /** + * Linear search for child with matching name + */ + tcGameObject* tcGameObject::GetChildByName(const std::string& name) const + { + size_t nChildren = children.size(); + for (size_t n=0; n<nChildren; n++) + { + if (name == children[n]->mzUnit.mz) + { + return children[n]; + } + } + + return 0; + } + + + tcGameObject* tcGameObject::GetChild(size_t idx) + { + if (idx < children.size()) + { + return children[idx]; + } + else + { + return 0; + } + } + + const char* tcGameObject::GetName() const + { + return mzUnit.mz; + } + + size_t tcGameObject::GetNumberOfChildren() const + { + return children.size(); + } + + /** * Linear search to verify child */ *************** *** 484,487 **** --- 527,532 ---- children[n] = children.back(); children.pop_back(); + + simState->UnregisterChildObject(child->GetName()); return; } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** Game.cpp 28 Mar 2006 23:58:12 -0000 1.154 --- Game.cpp 21 Apr 2006 23:29:09 -0000 1.155 *************** *** 49,52 **** --- 49,53 ---- #include "tcMessageCenter.h" #include "tcMessageInterface.h" + #include "tcMPGameView.h" #include "tcNetworkView.h" #include "tcDisplaySettingsView.h" *************** *** 96,99 **** --- 97,101 ---- EVT_COMMAND(ID_OPTIONSVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToOptions) EVT_COMMAND(ID_SCENARIOSELECTVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToScenarioSelect) + EVT_COMMAND(ID_MPGAMEVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToMPGameView) EVT_COMMAND(ID_MULTIPLAYERVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToNetwork) EVT_COMMAND(ID_BRIEFINGVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToBriefing) *************** *** 258,261 **** --- 260,264 ---- worldMap->SetActive(false); gameWindow->SetActive(false); + databaseViewer->SetActive(false); briefingView->SetButtonCaption(ID_STARTVIEW, "Return"); *************** *** 418,421 **** --- 421,429 ---- } + void tcGame::SwitchToMPGameView(wxCommandEvent& event) + { + meScreenMode = MPGAME; + } + void tcGame::SwitchToNetwork(wxCommandEvent& event) { *************** *** 548,551 **** --- 556,561 ---- InitializeNetworkView(); + InitializeMultiplayerGameSetup(); + InitializeMessageCenter(); *************** *** 789,792 **** --- 799,807 ---- } + void tcGame::InitializeMultiplayerGameSetup() + { + multiplayerGameSetup = new tcMPGameView(glCanvas, wxPoint(0,0), frameSize, "MPGameView"); + } + /** * Initialize network view interface *************** *** 1495,1498 **** --- 1510,1514 ---- messageCenter->SetActive(false); networkView->SetActive(false); + multiplayerGameSetup->SetActive(false); chatBox->SetActive(false); briefingView->SetActive(false); *************** *** 1506,1509 **** --- 1522,1526 ---- startView->SetActive(true); startView->Draw(); + viewer->SetActive(true); break; case CREDIT: *************** *** 1514,1521 **** --- 1531,1540 ---- creditView->SetActive(true); creditView->Draw(); + viewer->SetActive(false); break; case DATABASEVIEW: databaseViewer->SetActive(true); databaseViewer->Draw(); + viewer->SetActive(true); viewer->SetDatabaseView(true); if (lastMode != DATABASEVIEW) *************** *** 1523,1526 **** --- 1542,1547 ---- size3D = MODE3D_DATABASE; Update3DSize(); + /// reselect display class to update camera range + databaseViewer->SelectDisplayClass(databaseViewer->GetDisplayClass()); } break; *************** *** 1528,1547 **** --- 1549,1578 ---- optionsView->SetActive(true); optionsView->Draw(); + viewer->SetActive(false); break; case DISPLAYSETTINGS: displaySettingsView->SetActive(true); displaySettingsView->Draw(); + viewer->SetActive(false); break; case SCENARIOSELECT: scenarioSelectView->SetActive(true); scenarioSelectView->Draw(); + viewer->SetActive(true); break; case NETWORK: networkView->SetActive(true); networkView->Draw(); + viewer->SetActive(false); break; + case MPGAME: + multiplayerGameSetup->SetActive(true); + multiplayerGameSetup->Draw(); + viewer->SetActive(false); + break; case SIMPLEBRIEF: briefingView->SetActive(true); briefingView->Draw(); + viewer->SetActive(false); break; } *************** *** 1553,1557 **** } - viewer->SetActive(true); static float cameraTime = 0; --- 1584,1587 ---- *************** *** 1563,1568 **** } ! viewer->SetCameraAz(cameraTime); ! viewer->SetCameraEl(0.5f * sinf(0.1f*cameraTime)); if (meScreenMode != DATABASEVIEW) --- 1593,1601 ---- } ! //viewer->SetCameraAz(cameraTime); ! //viewer->SetCameraEl(0.5f * sinf(0.1f*cameraTime)); ! ! viewer->SetCameraSpinRate(0.01f); ! if (meScreenMode != DATABASEVIEW) *************** *** 1662,1665 **** --- 1695,1699 ---- viewer->SetActive(false); viewer->SetDatabaseView(false); + viewer->SetCameraSpinRate(0); worldMap->SetActive(false); tcMessageInterface::Get()->SetPopupChatText(false); *************** *** 1667,1671 **** gameWindow->SetActive(false); } - lastMode = meScreenMode; --- 1701,1704 ---- *************** *** 1782,1785 **** --- 1815,1826 ---- viewer->SetDatabaseView(true); viewer->SetActive(true); + if (lastMode != DATABASEVIEW) + { + size3D = MODE3D_DATABASE; + Update3DSize(); + viewer->SetCameraSpinRate(0.01f); + /// reselect display class to update camera range + databaseViewer->SelectDisplayClass(databaseViewer->GetDisplayClass()); + } } else if (meScreenMode == DISPLAYSETTINGS) *************** *** 1788,1791 **** --- 1829,1840 ---- displaySettingsView->Draw(); } + + if ((lastMode == DATABASEVIEW) && (meScreenMode != DATABASEVIEW)) + { + size3D = MODE3D_SMALL; + Update3DSize(); + } + + lastMode = meScreenMode; } *************** *** 2802,2825 **** * */ ! tcGame::tcGame(const wxPoint& pos, const wxSize& size) : ! wxFrame((wxFrame *)0, -1, "Global Conflict", pos, size, wxNO_FULL_REPAINT_ON_RESIZE), // | wxNO_FULL_REPAINT_ON_RESIZE | wxCLIP_CHILDREN ! framePos(pos.x, pos.y), frameSize(size.GetWidth(), size.GetHeight()), ! mnWidth(size.GetWidth()), mnHeight(size.GetHeight()), ! gameDateZulu(2000,4,10,5,0,0) { ! viewer = 0; ! infoConsole = 0; ! briefingConsoleLeft = 0; ! briefingConsoleBottom = 0; ! tacticalMap = 0; ! worldMap = 0; ! optionsView = 0; ! hookInfo = 0; ! objectControl = 0; ! oobView = 0; ! popupControl = 0; ! director = 0; ! networkView = 0; ! messageCenter = 0; SetBackgroundColour(*wxBLACK); --- 2851,2877 ---- * */ ! tcGame::tcGame(const wxPoint& pos, const wxSize& size) ! : ! wxFrame((wxFrame *)0, -1, "Global Conflict", pos, size, wxNO_FULL_REPAINT_ON_RESIZE), // | wxNO_FULL_REPAINT_ON_RESIZE | wxCLIP_CHILDREN ! framePos(pos.x, pos.y), frameSize(size.GetWidth(), size.GetHeight()), ! mnWidth(size.GetWidth()), mnHeight(size.GetHeight()), ! gameDateZulu(2000,4,10,5,0,0), ! viewer(0), ! infoConsole(0), ! briefingConsoleLeft(0), ! briefingConsoleBottom(0), ! tacticalMap(0), ! worldMap(0), ! optionsView(0), ! hookInfo(0), ! objectControl(0), ! oobView(0), ! popupControl(0), ! director(0), ! networkView(0), ! multiplayerGameSetup(0), ! messageCenter(0) { ! SetBackgroundColour(*wxBLACK);  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:29:13
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/src/graphics Modified Files: tc3DModel.cpp tc3DViewer.cpp tcButton.cpp tcDatabaseInfoWindow.cpp tcDatabaseViewer.cpp tcNetworkView.cpp Log Message: Index: tcDatabaseViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseViewer.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcDatabaseViewer.cpp 28 Mar 2006 23:58:12 -0000 1.3 --- tcDatabaseViewer.cpp 21 Apr 2006 23:29:09 -0000 1.4 *************** *** 58,61 **** --- 58,62 ---- { SetClassificationMask(PTYPE_SURFACE); + SetButtonOn(0); } *************** *** 63,66 **** --- 64,68 ---- { SetClassificationMask(PTYPE_SUBMARINE); + SetButtonOn(1); } *************** *** 68,71 **** --- 70,74 ---- { SetClassificationMask(PTYPE_FIXEDWING); + SetButtonOn(2); } *************** *** 73,76 **** --- 76,80 ---- { SetClassificationMask(PTYPE_HELO); + SetButtonOn(3); } *************** *** 78,81 **** --- 82,86 ---- { SetClassificationMask(PTYPE_FIXED); + SetButtonOn(4); } *************** *** 83,86 **** --- 88,92 ---- { SetClassificationMask(PTYPE_MISSILE); + SetButtonOn(5); } *************** *** 88,91 **** --- 94,98 ---- { SetClassificationMask(PTYPE_TORPEDO); + SetButtonOn(6); } *************** *** 93,96 **** --- 100,104 ---- { SetClassificationMask(PTYPE_BALLISTIC); + SetButtonOn(7); } *************** *** 121,124 **** --- 129,137 ---- } + const std::string& tcDatabaseViewer::GetDisplayClass() const + { + return displayClassName; + } + /** * *************** *** 231,239 **** float width = 64.0f; for (size_t n=0; n<nButtons; n++) { tcButton* button = new tcButton(this, wxPoint(x, y), wxSize(width, width)); ! button->LoadImages("test_button_off.png", "test_button_on.png", ! "test_button_on.png", "test_button_on.png"); button->SetActive(true); button->SetCommand(101 + n); --- 244,255 ---- float width = 64.0f; + wxASSERT(buttons.size() == 0); + buttons.clear(); + for (size_t n=0; n<nButtons; n++) { tcButton* button = new tcButton(this, wxPoint(x, y), wxSize(width, width)); ! buttons.push_back(button); ! button->SetActive(true); button->SetCommand(101 + n); *************** *** 245,257 **** switch (n) { ! case 0: caption = "Surface naval"; break; ! case 1: caption = "Submarine"; break; ! case 2: caption = "Air, fixed wing"; break; ! case 3: caption = "Air, rotary wing"; break; ! case 4: caption = "Land"; break; ! case 5: caption = "Missile"; break; ! case 6: caption = "Torpedo"; break; ! case 7: caption = "Ballistic"; break; ! default: caption = "Error"; break; } --- 261,309 ---- switch (n) { ! case 0: ! caption = "Surface naval"; ! button->LoadImages("dbviewer\\surface_off.png", "dbviewer\\surface_on.png", ! "dbviewer\\surface_over.png", "dbviewer\\surface_on.png"); ! break; ! case 1: ! caption = "Submarine"; ! button->LoadImages("dbviewer\\sub_off.png", "dbviewer\\sub_on.png", ! "dbviewer\\sub_over.png", "dbviewer\\sub_on.png"); ! break; ! case 2: ! caption = "Air, fixed wing"; ! button->LoadImages("dbviewer\\air_off.png", "dbviewer\\air_on.png", ! "dbviewer\\air_over.png", "dbviewer\\air_on.png"); ! break; ! case 3: ! caption = "Air, rotary wing"; ! button->LoadImages("dbviewer\\helo_off.png", "dbviewer\\helo_on.png", ! "dbviewer\\helo_over.png", "dbviewer\\helo_on.png"); ! break; ! case 4: ! caption = "Land"; ! button->LoadImages("dbviewer\\land_off.png", "dbviewer\\land_on.png", ! "dbviewer\\land_over.png", "dbviewer\\land_on.png"); ! break; ! case 5: ! caption = "Missile"; ! button->LoadImages("dbviewer\\missile_off.png", "dbviewer\\missile_on.png", ! "dbviewer\\missile_over.png", "dbviewer\\missile_on.png"); ! break; ! case 6: ! caption = "Torpedo"; ! button->LoadImages("dbviewer\\torpedo_off.png", "dbviewer\\torpedo_on.png", ! "dbviewer\\torpedo_over.png", "dbviewer\\torpedo_on.png"); ! break; ! case 7: ! caption = "Ballistic"; ! button->LoadImages("dbviewer\\ballistic_off.png", "dbviewer\\ballistic_on.png", ! "dbviewer\\ballistic_over.png", "dbviewer\\ballistic_on.png"); ! break; ! default: ! caption = "Error"; ! button->LoadImages("dbviewer\\test_button_off.png", "dbviewer\\test_button_on.png", ! "dbviewer\\test_button_on.png", "dbviewer\\test_button_on.png"); ! break; } *************** *** 302,308 **** --- 354,382 ---- } + void tcDatabaseViewer::SetButtonOn(size_t idx) + { + wxASSERT(buttons.size() == 8); + + // first set all buttons off + for (size_t n=0; n<buttons.size(); n++) + { + buttons[n]->SetOn(false); + } + + // set indicated button on + if (idx < buttons.size()) + { + buttons[idx]->SetOn(true); + } + else + { + wxASSERT(false); + } + + } void tcDatabaseViewer::SelectDisplayClass(const std::string& className) { + displayClassName = className; databaseInfoWindow->SetDatabaseClassName(className); if (viewer) *************** *** 347,355 **** } - - SetClassificationMask(PTYPE_SURFACE); - InitializeButtons(); InitializeDatabaseInfoWindow(); } --- 421,429 ---- } InitializeButtons(); InitializeDatabaseInfoWindow(); + + SetClassificationMask(PTYPE_SURFACE); + SetButtonOn(0); } Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tc3DModel.cpp 28 Mar 2006 02:44:55 -0000 1.35 --- tc3DModel.cpp 21 Apr 2006 23:29:08 -0000 1.36 *************** *** 414,417 **** --- 414,422 ---- } + const std::string& tc3DModel::GetAuthor() const + { + return author; + } + /** * Retrieves launcher info for launcher <idx> *************** *** 563,567 **** * @param model_name model file name with extension */ ! void tc3DModel::Load(std::string model_name) { if (modelNode.valid()) return; // model already loaded --- 568,572 ---- * @param model_name model file name with extension */ ! void tc3DModel::Load(const std::string& model_name) { if (modelNode.valid()) return; // model already loaded *************** *** 636,639 **** --- 641,646 ---- ProcessAnimations(); + LoadXmlInfo(doc); + delete doc; } *************** *** 702,705 **** --- 709,727 ---- /** + * Loads author info if available + */ + void tc3DModel::LoadXmlInfo(TiXmlDocument* doc) + { + TiXmlNode* node = doc->FirstChild("Info"); + if (node) + { + TiXmlElement* element = node->ToElement(); + wxASSERT(element); + author = element->Attribute("Author"); + } + } + + + /** * */ *************** *** 953,957 **** tc3DModel::tc3DModel() : gameObj(0), ! sensorTrack(0) { } --- 975,980 ---- tc3DModel::tc3DModel() : gameObj(0), ! sensorTrack(0), ! author("") { } *************** *** 964,968 **** : distanceFromCamera(1e10), gameObj(source->gameObj), ! sensorTrack(source->sensorTrack) { static int addCount = 0; --- 987,992 ---- : distanceFromCamera(1e10), gameObj(source->gameObj), ! sensorTrack(source->sensorTrack), ! author(source->author) { static int addCount = 0; Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcDatabaseInfoWindow.cpp 28 Mar 2006 23:58:12 -0000 1.5 --- tcDatabaseInfoWindow.cpp 21 Apr 2006 23:29:09 -0000 1.6 *************** *** 28,31 **** --- 28,36 ---- #include "tcDatabaseInfoWindow.h" #include "tcDatabaseObject.h" + #include "tcGenericDBObject.h" + #include "tcLauncherDBObject.h" + #include "tcMissileDBObject.h" + #include "tcTorpedoDBObject.h" + #include "tc3DModel.h" #include "tcSensorMap.h" #include "tcSimState.h" *************** *** 123,143 **** if (databaseObj == 0) return; ! s.Printf("Unit cost: %s", databaseObj->GetCostString()); ! DrawTextR(s.c_str(), textx, texty, ! defaultFont.get(), color, fontSize, LEFT_BASE_LINE, maxWidth, textBox); ! texty += textBox.yMax() - textBox.yMin() + 5.0f; ! s.Printf("%s", databaseObj->mzDescription); ! DrawTextR(s.c_str(), textx, texty, ! defaultFont.get(), color, fontSize, LEFT_BASE_LINE, maxWidth - 150.0f, textBox); - DrawDatabaseImages(); ! } void tcDatabaseInfoWindow::DrawDatabaseImages() { --- 128,339 ---- if (databaseObj == 0) return; ! DrawDatabaseImages(); ! PrintText(textx, texty, "Unit cost: %s", databaseObj->GetCostString()); + PrintText(textx, texty, "%s", databaseObj->mzDescription); ! texty += 5.0f; ! ! if (tcGenericDBObject* generic = dynamic_cast<tcGenericDBObject*>(databaseObj)) ! { ! DrawDatabaseInfo(generic, texty); ! } ! else if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(databaseObj)) ! { ! DrawDatabaseInfo(missile, texty); ! } ! else if (tcTorpedoDBObject* torpedo = dynamic_cast<tcTorpedoDBObject*>(databaseObj)) ! { ! DrawDatabaseInfo(torpedo, texty); ! } ! ! textx = xImage + 10.0f; ! texty = float(mnHeight) - 15.0f; ! const std::string& artists = databaseObj->Get3DModel()->GetAuthor(); ! if (artists.size() > 0) ! { ! PrintText(textx, texty, "3D Artist(s): %s", artists.c_str()); ! } } + void tcDatabaseInfoWindow::DrawDatabaseInfo(database::tcGenericDBObject* genericData, float yStart) + { + float textx = 10.0f; + float maxWidth = float(mnWidth) - textx - 5.0f; + float texty = yStart; + osg::BoundingBox textBox; + osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); + + + PrintText(textx, texty, "Max speed: %.0f kts", genericData->mfMaxSpeed_kts); + + if (IsEmbedded()) + { + PrintText(textx, texty, "Turn rate: %.1f deg/s", genericData->mfTurnRate_degps); + } + + + PrintText(textx, texty, "Survivability: %.0f", genericData->mfToughness); + + PrintText(textx, texty, "RCS %.0f dBsm", genericData->mfRcs_dbsm); + + if ((genericData->mfFuelRate_kgps > 0) && IsEmbedded()) + { + float fuelTimeHours = 2.778e-4 * genericData->mfFuelCapacity_kg / genericData->mfFuelRate_kgps; + + switch (genericData->mnModelType) + { + case MTYPE_SURFACE: + case MTYPE_CARRIER: + case MTYPE_AIR: + PrintText(textx, texty, "Cruise range %.0f km", fuelTimeHours * genericData->mfMaxSpeed_kts * C_NMITOKM); + break; + case MTYPE_FIXEDWINGX: + PrintText(textx, texty, "Fuel capacity %.0f kg", genericData->mfFuelCapacity_kg); + break; + case MTYPE_HELO: + PrintText(textx, texty, "Endurance %.1f hrs", 2.0f * fuelTimeHours); + break; + case MTYPE_SUBMARINE: + PrintText(textx, texty, "Fuel capacity %.0f kg", genericData->mfFuelCapacity_kg); + break; + } + } + + texty += 10.0f; + DrawLauncherInfo(genericData, texty); + + texty += 10.0f; + DrawSensorInfo(genericData, texty); + } + + + void tcDatabaseInfoWindow::DrawDatabaseInfo(database::tcMissileDBObject* missileData, float yStart) + { + wxASSERT(missileData); + + float textx = 10.0f; + float texty = yStart; + + PrintText(textx, texty, "Nominal range %.0f km", missileData->mfRange_km); + + PrintText(textx, texty, "Max speed Mach %.1f", missileData->mfMsupm); + + PrintText(textx, texty, "Warhead %.0f kg", missileData->mfDamage); + + PrintText(textx, texty, "Seeker FOV %.0f deg", missileData->GetSeekerFOV()); + + } + + void tcDatabaseInfoWindow::DrawDatabaseInfo(database::tcTorpedoDBObject* torpedoData, float yStart) + { + wxASSERT(torpedoData); + + float textx = 10.0f; + float texty = yStart; + + if (torpedoData->batteryRate_kW > 0) + { + float range_km = 2.778e-4f * C_NMITOKM * torpedoData->maxSpeed_kts * torpedoData->battery_kJ / + torpedoData->batteryRate_kW; + PrintText(textx, texty, "Range %.0f km", range_km); + } + else + { + PrintText(textx, texty, "Nominal range %.0f km", torpedoData->mfRange_km); + } + + PrintText(textx, texty, "Max speed %.0f kts", torpedoData->maxSpeed_kts); + + PrintText(textx, texty, "Warhead %.0f kg", torpedoData->mfDamage); + + } + + + void tcDatabaseInfoWindow::DrawLauncherInfo(database::tcGenericDBObject* genericData, float& y) + { + wxASSERT(genericData != 0); + + int nLaunchers = genericData->mnNumLaunchers; + if (nLaunchers <= 0) return; + + PrintText(10.0, y, "MOUNTS"); + + database::tcDatabase* database = tcDatabase::Get(); + + for (int n=0; n<nLaunchers; n++) + { + std::string launcherClass = genericData->maLauncherClass[n].c_str(); + database::tcLauncherDBObject* launcherData = + dynamic_cast<database::tcLauncherDBObject*>( + database->GetObject(launcherClass)); + wxString s = launcherData->GetConfigurationDescription(); + PrintText(20.0, y, "%s", s.c_str()); + } + + } + + void tcDatabaseInfoWindow::DrawSensorInfo(database::tcGenericDBObject* genericData, float& y) + { + wxASSERT(genericData != 0); + + int nSensors = genericData->sensorClass.size(); + if (nSensors <= 0) return; + + database::tcDatabase* database = tcDatabase::Get(); + + PrintText(10.0, y, "SENSORS"); + + for (int n=0; n<nSensors; n++) + { + std::string& sensorClass = genericData->sensorClass[n]; + database::tcRadarDBObject* radarData = dynamic_cast<database::tcRadarDBObject*>( + database->GetObject(sensorClass)); + if (radarData) + { + float displayRange = 0; + if (radarData->mbDetectsAir) displayRange = 2.0f * radarData->mfRefRange_km; // 12 dBsm assumed + else displayRange = 5.66f * radarData->mfRefRange_km; // 30 dBsm assumed + + PrintText(20.0, y, "%s (%.0f km)", sensorClass.c_str(), displayRange); + } + else + { + PrintText(20.0, y, "%s", sensorClass.c_str()); + } + } + + } + + void tcDatabaseInfoWindow::PrintText(float x, float& y, const char* formatString, ...) + { + enum {STR_LENGTH = 256}; + static char textBuffer[STR_LENGTH]; + static osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); + static osg::BoundingBox textBox; + + const float textFontSize = 12.0f; + + if (y > float(mnHeight) - 15.0f) return; + + va_list arguments; + + va_start(arguments, formatString); + _vsnprintf(textBuffer, STR_LENGTH, formatString, arguments); + va_end(arguments); + + float maxWidth = (y < yImage) ? xImage - x : float(mnWidth) - x; + + DrawTextR(textBuffer, x, y, + defaultFont.get(), color, textFontSize, LEFT_BASE_LINE, maxWidth, textBox); + + y += textBox.yMax() - textBox.yMin() + 2.0f; + + } + void tcDatabaseInfoWindow::DrawDatabaseImages() { *************** *** 155,158 **** --- 351,357 ---- } + xImage = imagex - 5.0f; + yImage = imagey + imageHeight; + size_t nImages = imageList.size(); *************** *** 372,376 **** databaseClassName(""), currentImageIdx(0), ! imageTime(0) { --- 571,577 ---- databaseClassName(""), currentImageIdx(0), ! imageTime(0), ! xImage(0), ! yImage(0) { Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcNetworkView.cpp 23 Mar 2006 01:11:02 -0000 1.12 --- tcNetworkView.cpp 21 Apr 2006 23:29:09 -0000 1.13 *************** *** 2,7 **** ** @file tcNetworkView.cpp */ ! /* ! ** Copyright (C) 2004-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tcNetworkView.cpp */ ! /* Copyright (C) 2004-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcButton.cpp 28 Mar 2006 23:58:12 -0000 1.23 --- tcButton.cpp 21 Apr 2006 23:29:09 -0000 1.24 *************** *** 125,129 **** float y = (float)mouseOverCaptionPosition.y; osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); ! float mouseOverCaptionFontSize = 11.0f; DrawText(mouseOverCaption.c_str(), x, y, defaultFont.get(), color, mouseOverCaptionFontSize, CENTER_CENTER); --- 125,129 ---- float y = (float)mouseOverCaptionPosition.y; osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); ! float mouseOverCaptionFontSize = 12.0f; DrawText(mouseOverCaption.c_str(), x, y, defaultFont.get(), color, mouseOverCaptionFontSize, CENTER_CENTER); *************** *** 266,270 **** forceDisable(false), mouseOverCaption(""), ! mouseOverCaptionPosition(0, -5) { --- 266,270 ---- forceDisable(false), mouseOverCaption(""), ! mouseOverCaptionPosition(0, 0) { *************** *** 397,401 **** forceDisable(false), mouseOverCaption(""), ! mouseOverCaptionPosition(size.GetWidth()/2, -5) { --- 397,401 ---- forceDisable(false), mouseOverCaption(""), ! mouseOverCaptionPosition(size.GetWidth()/2, 0) { Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tc3DViewer.cpp 28 Mar 2006 23:58:12 -0000 1.33 --- tc3DViewer.cpp 21 Apr 2006 23:29:08 -0000 1.34 *************** *** 65,68 **** --- 65,69 ---- #include "tcSensorTrackIterator.h" #include "tcDatabase.h" + #include "tcTime.h" *************** *** 624,627 **** --- 625,633 ---- } + void tc3DViewer::SetCameraSpinRate(float rate) + { + cameraSpinRate = rate; + } + /** * Set the origin (0,0) of 3D world coordinates and *************** *** 1060,1063 **** --- 1066,1071 ---- void tc3DViewer::UpdateCameraDatabaseView() { + UpdateCameraSpin(); + float camx = cosf(cameraEl)*sinf(cameraAz); float camy = cosf(cameraEl)*cosf(cameraAz); *************** *** 1076,1079 **** --- 1084,1089 ---- osg::Vec3 targetPosition = GetHookedObjectPositionAndType(objClassification); + UpdateCameraSpin(); + if (moveWithTarget) { *************** *** 1181,1184 **** --- 1191,1206 ---- } + void tc3DViewer::UpdateCameraSpin() + { + if (cameraSpinRate == 0) return; + + unsigned currentTimeCount = tcTime::Get()->Get30HzCount(); + if (currentTimeCount - lastSpinCount >= 1) + { + SetCameraAz(GetCameraAz() + cameraSpinRate); + lastSpinCount = currentTimeCount; + } + } + /** * Load models for new child objects. *************** *** 2068,2072 **** wxWindow(parent, -1, pos, size, wxTRANSPARENT_WINDOW | wxNO_FULL_REPAINT_ON_RESIZE, name), mnHeight(size.GetHeight()), mnWidth(size.GetWidth()), ! cameraWalkOffset(0, 0, 0) { glCanvas = parent; --- 2090,2096 ---- wxWindow(parent, -1, pos, size, wxTRANSPARENT_WINDOW | wxNO_FULL_REPAINT_ON_RESIZE, name), mnHeight(size.GetHeight()), mnWidth(size.GetWidth()), ! cameraWalkOffset(0, 0, 0), ! cameraSpinRate(0), ! lastSpinCount(0) { glCanvas = parent;  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:29:12
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/src/network Modified Files: tcMultiplayerInterface.cpp Log Message: Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcMultiplayerInterface.cpp 26 Mar 2006 00:32:14 -0000 1.34 --- tcMultiplayerInterface.cpp 21 Apr 2006 23:29:09 -0000 1.35 *************** *** 121,124 **** --- 121,129 ---- } + bool tcPlayerStatus::IsCommander() const + { + return isCommander; + } + bool tcPlayerStatus::IsGM() const { *************** *** 1990,1993 **** --- 1995,1999 ---- stat.sensorUpdateTime = 0; stat.name = "Anonymous"; + stat.isCommander = false; stat.isAuthenticated = false;  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:29:12
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/src/scriptinterface Modified Files: tcScenarioInterface.cpp Log Message: Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tcScenarioInterface.cpp 26 Mar 2006 00:32:15 -0000 1.39 --- tcScenarioInterface.cpp 21 Apr 2006 23:29:09 -0000 1.40 *************** *** 1,6 **** /* ! ** tcScenarioInterface.cpp ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 1,6 ---- /* ! ** @file tcScenarioInterface.cpp ! */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved.  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:28:36
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8443/include/graphics Modified Files: tc3DModel.h tc3DViewer.h tcDatabaseInfoWindow.h tcDatabaseViewer.h Log Message: Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tc3DModel.h 22 Mar 2006 01:23:28 -0000 1.21 --- tc3DModel.h 21 Apr 2006 23:28:31 -0000 1.22 *************** *** 115,118 **** --- 115,119 ---- void DetachFromParent(); + const std::string& GetAuthor() const; tcGameObject* GetGameObj() const {return gameObj;} void GetLauncherInfo(unsigned int idx, osg::Vec3& pos, float& az, float& el) const; *************** *** 152,155 **** --- 153,158 ---- float pointingElevation; ///< relative elevation, default 0 }; + std::string author; // from Info Author attribute in xml model file + tcSmoker smokeTrails; *************** *** 188,193 **** void DisableSmoke(); void EnableSmoke(); ! void Load(std::string model_name); void LoadXmlAnimationInfo(TiXmlDocument* doc); void LoadXmlMountInfo(TiXmlDocument* doc); void LoadXmlSmokeInfo(TiXmlDocument* doc); --- 191,197 ---- void DisableSmoke(); void EnableSmoke(); ! void Load(const std::string& model_name); void LoadXmlAnimationInfo(TiXmlDocument* doc); + void LoadXmlInfo(TiXmlDocument* doc); void LoadXmlMountInfo(TiXmlDocument* doc); void LoadXmlSmokeInfo(TiXmlDocument* doc); Index: tc3DViewer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DViewer.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tc3DViewer.h 28 Mar 2006 02:44:45 -0000 1.14 --- tc3DViewer.h 21 Apr 2006 23:28:31 -0000 1.15 *************** *** 157,160 **** --- 157,161 ---- void SetCameraEl(float el); void SetCameraRange(float range_m); + void SetCameraSpinRate(float rate); void SetDatabaseView(bool state); void SetDatabaseViewClass(const std::string& databaseClass); *************** *** 224,227 **** --- 225,230 ---- float cameraEl; ///< camera elevation relative to target for moveWith modes float cameraRange; ///< range of camera relative to target for moveWith modes + float cameraSpinRate; ///< rate in rad/frame to spin camera, use 0 to disable + unsigned int lastSpinCount; ///< time at which spin az offset was adjusted float cameraLookAz; ///< look az for non-lookat modes float cameraLookEl; ///< look el for non-lookat modes *************** *** 246,249 **** --- 249,253 ---- void UpdateCamera(); void UpdateCameraDatabaseView(); + void UpdateCameraSpin(); void UpdateChildModels(tcGameObject *gameObj); bool UpdateOrigin(); Index: tcDatabaseInfoWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDatabaseInfoWindow.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcDatabaseInfoWindow.h 28 Mar 2006 23:58:03 -0000 1.4 --- tcDatabaseInfoWindow.h 21 Apr 2006 23:28:31 -0000 1.5 *************** *** 30,37 **** --- 30,41 ---- #include "tcXmlWindow.h" + #include <stdarg.h> namespace database { class tcDatabaseObject; + class tcGenericDBObject; + class tcMissileDBObject; + class tcTorpedoDBObject; } *************** *** 99,107 **** --- 103,120 ---- size_t currentImageIdx; ///< index of current image displayed (to cycle through available images) unsigned int imageTime; ///< time at which current image was first displayed + float xImage; ///< x coordinate of image + float yImage; ///< y coordinate of image static tc3DWindow* parent; void DrawDatabaseInfo(); + void DrawDatabaseInfo(database::tcGenericDBObject* genericData, float yStart); + void DrawDatabaseInfo(database::tcMissileDBObject* missileData, float yStart); + void DrawDatabaseInfo(database::tcTorpedoDBObject* torpedoData, float yStart); void DrawDatabaseImages(); + void DrawLauncherInfo(database::tcGenericDBObject* genericData, float& y); + void DrawSensorInfo(database::tcGenericDBObject* genericData, float& y); + void PrintText(float x, float& y, const char* formatString, ...); + database::tcDatabaseObject* GetDatabaseObject(); void LoadImageList(); Index: tcDatabaseViewer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDatabaseViewer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcDatabaseViewer.h 28 Mar 2006 02:44:45 -0000 1.2 --- tcDatabaseViewer.h 21 Apr 2006 23:28:31 -0000 1.3 *************** *** 37,40 **** --- 37,41 ---- class tcDatabaseInfoWindow; class tc3DViewer; + class tcButton; namespace osg *************** *** 65,68 **** --- 66,70 ---- void OnLButtonDown(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); + const std::string& GetDisplayClass() const; void SelectDisplayClass(const std::string& className); void SetClassificationMask(unsigned int mask); *************** *** 83,86 **** --- 85,89 ---- tcDatabaseInfoWindow* databaseInfoWindow; tc3DViewer* viewer; + std::vector<tcButton*> buttons; const wxRealPoint basePosition; *************** *** 100,103 **** --- 103,107 ---- void InitializeDatabaseInfoWindow(); bool ProcessMouseClick(std::vector<BrowseItem>& info, wxPoint pos); + void SetButtonOn(size_t idx); void UpdateDrawInfo(std::vector<BrowseItem>& info);  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:28:36
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8443/include/sim Modified Files: Game.h tcGameObject.h tcSimState.h Log Message: Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tcGameObject.h 27 Mar 2006 01:08:30 -0000 1.46 --- tcGameObject.h 21 Apr 2006 23:28:32 -0000 1.47 *************** *** 2,7 **** ** @file tcGameObject.h */ ! /* ! ** Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tcGameObject.h */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 130,138 **** osg::Vec3 ConvertModelCoordinatesToWorld(const osg::Vec3& x) const; void AddChild(tcGameObject *child); tcGameObject* GetChildById(long id) const; bool IsChild(const tcGameObject* child) const; void RemoveChild(tcGameObject *child); ! virtual void Clear(void); ! virtual void ClearChildren(void); void GetRelPosOf(tcGameObject *obj, tsRelativePosition& rel_pos); void GetRelativeStateLocal(tcGameObject *obj, osg::Vec3& position, osg::Vec3& velocity); --- 129,142 ---- osg::Vec3 ConvertModelCoordinatesToWorld(const osg::Vec3& x) const; void AddChild(tcGameObject *child); + tcGameObject* GetChild(size_t idx); tcGameObject* GetChildById(long id) const; + tcGameObject* GetChildByName(const std::string& name) const; + size_t GetNumberOfChildren() const; + const char* GetName() const; ///< returns instance name of this obj (mzUnit) + bool IsChild(const tcGameObject* child) const; void RemoveChild(tcGameObject *child); ! virtual void Clear(); ! virtual void ClearChildren(); void GetRelPosOf(tcGameObject *obj, tsRelativePosition& rel_pos); void GetRelativeStateLocal(tcGameObject *obj, osg::Vec3& position, osg::Vec3& velocity); Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** tcSimState.h 27 Mar 2006 01:08:30 -0000 1.48 --- tcSimState.h 21 Apr 2006 23:28:32 -0000 1.49 *************** *** 169,172 **** --- 169,173 ---- tcGameObject* reference, float sensorAz, long fcID = -1, unsigned fcIdx = 0); void RandInit(); + void RegisterChildObject(const std::string& name, tcGameObject* parent); ///< call when adding child to flightdeck void RemoveDestroyedObjects(); void RenameObject(tcGameObject* obj, const std::string& s); *************** *** 189,192 **** --- 190,194 ---- void SetTime(double afNewTime) {mfSimTime=afNewTime;} /////< Sets sim time, normally 0 at start of sim void SetTimeAcceleration(long accel); + void UnregisterChildObject(const std::string& name); void Update(); void UpdateAI(double afSimTime); *************** *** 208,211 **** --- 210,214 ---- long timeAcceleration; ///< 0 - paused, 1 - normal, N - Nx accelerated time std::map<std::string, long> objectNameMap; ///< for fast lookup by object name + std::map<std::string, long> captiveObjectMap; ///< lookup of captive flightdeck objects, secondary key is parent id tcPositionRegistry* positionRegistry; ///< for fast(er) lookup by region Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Game.h 28 Mar 2006 23:58:03 -0000 1.68 --- Game.h 21 Apr 2006 23:28:32 -0000 1.69 *************** *** 74,77 **** --- 74,78 ---- class tcBriefingView; class tcDatabaseViewer; + class tcMPGameView; using namespace scriptinterface; *************** *** 103,106 **** --- 104,108 ---- DATABASEVIEW, MESSAGES, + MPGAME, NETWORK, DISPLAYSETTINGS, *************** *** 176,179 **** --- 178,182 ---- tcDirector* director; ///< displays scripted graphics and controls view for dramatic mission brief tcMessageCenter* messageCenter; ///< tasking, intel, etc. message view + tcMPGameView* multiplayerGameSetup; ///< multiplayer game/team setup after connected tcNetworkView* networkView; ///< network and multiplayer setup and test tcDisplaySettingsView* displaySettingsView; *************** *** 287,290 **** --- 290,294 ---- void SwitchToDatabaseView(wxCommandEvent& event); void SwitchToDisplaySettings(wxCommandEvent& event); + void SwitchToMPGameView(wxCommandEvent& event); void SwitchToNetwork(wxCommandEvent& event); void SwitchToOptions(wxCommandEvent& event); *************** *** 308,311 **** --- 312,316 ---- void InitializeGameWindow(); void InitializeMessageCenter(); + void InitializeMultiplayerGameSetup(); void InitializeNetworkView(); void InitializeOptionsView();  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:28:36
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8443/include/network Modified Files: tcMultiplayerInterface.h Log Message: Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcMultiplayerInterface.h 22 Mar 2006 01:23:29 -0000 1.28 --- tcMultiplayerInterface.h 21 Apr 2006 23:28:32 -0000 1.29 *************** *** 61,66 **** std::string nameWithRank; ///< name with rank title bool isAuthenticated; ///< true if password has been verified ! unsigned char alliance; ///< player's alliance unsigned char rank; ///< player's rank unsigned int timestamp; ///< time of last network update (30 Hz tics) unsigned int startTime; ///< time connection started (30 Hz tics) --- 61,67 ---- std::string nameWithRank; ///< name with rank title bool isAuthenticated; ///< true if password has been verified ! unsigned char alliance; ///< player's alliance for current game, or 0 if not selected unsigned char rank; ///< player's rank + bool isCommander; ///< true if player is commander for alliance unsigned int timestamp; ///< time of last network update (30 Hz tics) unsigned int startTime; ///< time connection started (30 Hz tics) *************** *** 79,82 **** --- 80,84 ---- const std::string& GetNameWithRank() const; unsigned char GetRank() const; + bool IsCommander() const; bool IsGM() const; void SetAlliance(unsigned char val);  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:28:36
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8443/include/common Modified Files: math_constants.h wxcommands.h Log Message: Index: wxcommands.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/wxcommands.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** wxcommands.h 22 Mar 2006 01:23:28 -0000 1.22 --- wxcommands.h 21 Apr 2006 23:28:31 -0000 1.23 *************** *** 36,40 **** ID_DISPLAYSETTINGS = 42, ///< switch to display settings view ID_SCENARIOSELECTVIEW = 50, ///< switch to scenario select view ! ID_MULTIPLAYERVIEW = 60, ///< switch to multiplayer view ID_BRIEFINGVIEW = 65, ///< switch to simple briefing view ID_STARTGAME = 70, ///< start game --- 36,41 ---- ID_DISPLAYSETTINGS = 42, ///< switch to display settings view ID_SCENARIOSELECTVIEW = 50, ///< switch to scenario select view ! ID_MULTIPLAYERVIEW = 60, ///< switch to multiplayer view (view before connection established) ! ID_MPGAMEVIEW = 62, ///< switch to multiplayer game view (view after connection established) ID_BRIEFINGVIEW = 65, ///< switch to simple briefing view ID_STARTGAME = 70, ///< start game Index: math_constants.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/math_constants.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** math_constants.h 22 Mar 2006 01:23:28 -0000 1.12 --- math_constants.h 21 Apr 2006 23:28:31 -0000 1.13 *************** *** 34,37 **** --- 34,38 ---- #define C_180OVERPI 57.295779513f #define C_NMITOM 1852.0f + #define C_NMITOKM 1.852f #define C_KMTONMI 0.53995680f #define C_KMTODEG 0.0089992800f  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:28:36
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8443/include/database Modified Files: tcLauncherDBObject.h Log Message: Index: tcLauncherDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcLauncherDBObject.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcLauncherDBObject.h 22 Mar 2006 01:23:28 -0000 1.15 --- tcLauncherDBObject.h 21 Apr 2006 23:28:31 -0000 1.16 *************** *** 59,63 **** const std::string& GetConfigurationClass(unsigned int idx) const; unsigned int GetNumberConfigurations() const; ! unsigned short GetDefaultChildCapacity() const; const char* GetDefaultChildClass() const; ///< @returns default class name for this launcher --- 59,63 ---- const std::string& GetConfigurationClass(unsigned int idx) const; unsigned int GetNumberConfigurations() const; ! const wxString& GetConfigurationDescription() const; unsigned short GetDefaultChildCapacity() const; const char* GetDefaultChildClass() const; ///< @returns default class name for this launcher  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-04-21 23:28:36
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8443/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** tcPlatformInterface.h 22 Mar 2006 01:23:29 -0000 1.49 --- tcPlatformInterface.h 21 Apr 2006 23:28:32 -0000 1.50 *************** *** 201,205 **** /// returns true if launcher is effective vs. current target bool IsLauncherEffective(int anLauncher); ! /// if target is valid, sets heading to intercept target. float SetHeadingToInterceptTarget(); --- 201,205 ---- /// returns true if launcher is effective vs. current target bool IsLauncherEffective(int anLauncher); ! /// if target is valid, sets heading to intercept target (collision course intercept) float SetHeadingToInterceptTarget();  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-03-28 23:58:17
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9518/src/common Modified Files: tcOptionsView.cpp Log Message: Index: tcOptionsView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptionsView.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcOptionsView.cpp 23 Mar 2006 01:11:01 -0000 1.15 --- tcOptionsView.cpp 28 Mar 2006 23:58:12 -0000 1.16 *************** *** 62,67 **** void tcOptionsView::Draw() { ! static int nTestCount = 0; wxASSERT(mpOptions); --- 62,68 ---- void tcOptionsView::Draw() { ! static unsigned int drawCount = 0; + if (drawCount++ % 3 != 0) return; // don't update every frame wxASSERT(mpOptions);  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-03-28 23:58:17
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9518/src/sim Modified Files: Game.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** Game.cpp 28 Mar 2006 02:44:56 -0000 1.153 --- Game.cpp 28 Mar 2006 23:58:12 -0000 1.154 *************** *** 472,475 **** --- 472,482 ---- r.height = mnHeight; } + else if (size3D == MODE3D_DATABASE) // for database viewer screen + { + r.x = 300; + r.y = mnHeight - 550; + r.width = mnWidth - r.x; + r.height = mnHeight - r.y; + } else // (size3D == MODE3D_START) { *************** *** 1512,1515 **** --- 1519,1527 ---- databaseViewer->Draw(); viewer->SetDatabaseView(true); + if (lastMode != DATABASEVIEW) + { + size3D = MODE3D_DATABASE; + Update3DSize(); + } break; case OPTIONS: *************** *** 1534,1538 **** break; } ! viewer->SetActive(true); static float cameraTime = 0; --- 1546,1557 ---- break; } ! ! if ((lastMode == DATABASEVIEW) && (meScreenMode != DATABASEVIEW)) ! { ! size3D = MODE3D_START; ! Update3DSize(); ! } ! ! viewer->SetActive(true); static float cameraTime = 0; *************** *** 1642,1645 **** --- 1661,1665 ---- tacticalMap->SetActive(false); viewer->SetActive(false); + viewer->SetDatabaseView(false); worldMap->SetActive(false); tcMessageInterface::Get()->SetPopupChatText(false); *************** *** 1760,1763 **** --- 1780,1785 ---- databaseViewer->SetActive(true); databaseViewer->Draw(); + viewer->SetDatabaseView(true); + viewer->SetActive(true); } else if (meScreenMode == DISPLAYSETTINGS)  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-03-28 23:58:16
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9518/src/graphics Modified Files: tc3DViewer.cpp tcButton.cpp tcDatabaseInfoWindow.cpp tcDatabaseViewer.cpp Log Message: Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcDatabaseInfoWindow.cpp 28 Mar 2006 02:44:55 -0000 1.4 --- tcDatabaseInfoWindow.cpp 28 Mar 2006 23:58:12 -0000 1.5 *************** *** 68,71 **** --- 68,73 ---- if (FinishDestroy()) return; + if (drawCount++ % 2 != 0) return; + DrawChildren(); *************** *** 97,101 **** else { ! s.Printf("No info available"); } --- 99,110 ---- else { ! if (IsPopup()) ! { ! s.Printf("No info available"); ! } ! else ! { ! s.Printf(""); ! } } *************** *** 123,144 **** defaultFont.get(), color, fontSize, LEFT_BASE_LINE, maxWidth - 150.0f, textBox); ! float imagex = 265.0; ! float imagey = 10.0; size_t nImages = imageList.size(); if (nImages > 0) { ! DrawImageR(imageList[currentImageIdx].get(), imagex, imagey, 128.0f, 100.0f, ALIGN_BOTTOM_LEFT); ! DrawRectangleR(imagex, imagey, 128.0f, 100.0f, osg::Vec4(1, 1, 1, 0.5)); ! // cycle through images ! unsigned int t = tcTime::Get()->Get30HzCount(); ! if (t - imageTime > 90) { ! currentImageIdx = (currentImageIdx + 1) % nImages; ! imageTime = t; } } - - } --- 132,177 ---- defaultFont.get(), color, fontSize, LEFT_BASE_LINE, maxWidth - 150.0f, textBox); ! ! DrawDatabaseImages(); ! ! ! ! } ! ! ! void tcDatabaseInfoWindow::DrawDatabaseImages() ! { ! float imageWidth = 150.0f; ! float imageHeight = 100.0f; ! float imagex = float(mnWidth) - imageWidth - 20.0f; ! float imagey = 10.0f; ! ! if (IsEmbedded()) ! { ! imageWidth = 300.0f; ! imageHeight = 200.0f; ! imagex = float(mnWidth) - imageWidth - 10.0f; ! imagey = 10.0f; ! } ! ! size_t nImages = imageList.size(); if (nImages > 0) { ! DrawImageR(imageList[currentImageIdx].get(), imagex, imagey, imageWidth, imageHeight, ALIGN_BOTTOM_LEFT); ! DrawRectangleR(imagex, imagey, imageWidth, imageHeight, osg::Vec4(1, 1, 1, 0.5)); ! // cycle through images if embedded, otherwise just show the first one ! if (IsEmbedded()) { ! unsigned int t = tcTime::Get()->Get30HzCount(); ! if (t - imageTime > 90) ! { ! currentImageIdx = (currentImageIdx + 1) % nImages; ! imageTime = t; ! tcSound::Get()->PlayEffect("MutedBeep"); ! } } } } *************** *** 192,195 **** --- 225,240 ---- } + + bool tcDatabaseInfoWindow::IsEmbedded() const + { + return (viewMode == EMBED); + } + + bool tcDatabaseInfoWindow::IsPopup() const + { + return (viewMode == POPUP); + } + + void tcDatabaseInfoWindow::LoadImageList() { *************** *** 206,209 **** --- 251,256 ---- if (tex.valid()) imageList.push_back(tex); } + + currentImageIdx = 0; } *************** *** 274,277 **** --- 321,325 ---- { databaseClassName = className; + LoadImageList(); } *************** *** 325,333 **** currentImageIdx(0), imageTime(0) - { wxASSERT(hostParent != 0); // put gui window on top SetBaseRenderBin(hostParent->GetBaseRenderBin() + windowLayer*10); --- 373,382 ---- currentImageIdx(0), imageTime(0) { wxASSERT(hostParent != 0); + viewMode = (hostParent == parent) ? POPUP : EMBED; + // put gui window on top SetBaseRenderBin(hostParent->GetBaseRenderBin() + windowLayer*10); *************** *** 345,366 **** TiXmlNode* current = root; - /* - TiXmlElement* elt = current->ToElement(); - - // background image - std::string imageName = elt->Attribute("BackgroundImage"); - if (imageName.size() > 2) - { - LoadBackgroundImage(imageName.c_str()); - } ! // size of window - int xmlWidth, xmlHeight; - elt->Attribute("Width", &xmlWidth); - elt->Attribute("Height", &xmlHeight); - - SetSize(pos.x, pos.y, xmlWidth, xmlHeight); // set all size params - */ SetBackgroundColor(osg::Vec4(0.2f, 0.2f, 0.2f, 0.5f)); --- 394,403 ---- TiXmlNode* current = root; ! if (viewMode == EMBED) ! { ! SetSize(pos.x, pos.y, 600.0f, 400.0f); // set all size params ! } SetBackgroundColor(osg::Vec4(0.2f, 0.2f, 0.2f, 0.5f)); Index: tcButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcButton.cpp 27 Mar 2006 01:08:17 -0000 1.22 --- tcButton.cpp 28 Mar 2006 23:58:12 -0000 1.23 *************** *** 59,62 **** --- 59,64 ---- if (isMouseOver) { + DrawMouseOverCaption(); + if (isButtonOn) { *************** *** 72,75 **** --- 74,78 ---- { tc3DWindow::DrawImage(image, 0, 0, mnWidth, mnHeight, LEFT_BASE_LINE); + HideUnusedObjects(); return; *************** *** 115,118 **** --- 118,133 ---- } + void tcButton::DrawMouseOverCaption() + { + if (mouseOverCaption.size() == 0) return; + + float x = (float)mouseOverCaptionPosition.x; + float y = (float)mouseOverCaptionPosition.y; + osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); + float mouseOverCaptionFontSize = 11.0f; + + DrawText(mouseOverCaption.c_str(), x, y, defaultFont.get(), color, mouseOverCaptionFontSize, CENTER_CENTER); + } + /** *************** *** 221,224 **** --- 236,251 ---- } + + void tcButton::SetMouseOverCaption(const std::string& s) + { + mouseOverCaption = s; + } + + void tcButton::SetMouseOverCaptionPosition(const wxPoint& pos) + { + mouseOverCaptionPosition = pos; + } + + /** * version to initialize from XML file *************** *** 237,241 **** sendRedraw(false), backgroundAlpha(1.0f), ! forceDisable(false) { --- 264,270 ---- sendRedraw(false), backgroundAlpha(1.0f), ! forceDisable(false), ! mouseOverCaption(""), ! mouseOverCaptionPosition(0, -5) { *************** *** 346,349 **** --- 375,380 ---- SetSize(x, y, width, height); // set all size params + mouseOverCaptionPosition.x = width / 2; + fprintf(stdout,"Created button %s, pos (%d,%d), size: (%d,%d)\n", caption.c_str(), x, y, width, height); *************** *** 364,368 **** sendRedraw(false), backgroundAlpha(1.0f), ! forceDisable(false) { --- 395,401 ---- sendRedraw(false), backgroundAlpha(1.0f), ! forceDisable(false), ! mouseOverCaption(""), ! mouseOverCaptionPosition(size.GetWidth()/2, -5) { Index: tcDatabaseViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseViewer.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcDatabaseViewer.cpp 28 Mar 2006 02:44:55 -0000 1.2 --- tcDatabaseViewer.cpp 28 Mar 2006 23:58:12 -0000 1.3 *************** *** 256,260 **** } ! button->SetCaption(caption); } --- 256,260 ---- } ! button->SetMouseOverCaption(caption); } Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tc3DViewer.cpp 28 Mar 2006 02:44:55 -0000 1.32 --- tc3DViewer.cpp 28 Mar 2006 23:58:12 -0000 1.33 *************** *** 379,382 **** --- 379,384 ---- orthoProjection->setMatrix(osg::Matrix::ortho2D(0,(double)size.GetWidth(),0,(double)size.GetHeight())); viewerText->setPosition(osg::Vec3(20.0f,(float)mnHeight * 0.9f,0.0f)); + + databaseView->setViewport(pos.x, correctedY, size.GetWidth(), size.GetHeight()); } *************** *** 504,508 **** wxASSERT(node.valid()); databaseViewGroup->addChild(node.get()); ! SetCameraRange(1.5f * node->getBound().radius()); } } --- 506,510 ---- wxASSERT(node.valid()); databaseViewGroup->addChild(node.get()); ! SetCameraRange(5.0f + 1.5f * node->getBound().radius()); } } *************** *** 2040,2047 **** float aspectRatio = (float)windowSize.GetWidth() / (float)windowSize.GetHeight(); if (useFarSceneView) ! { ! float zmid = sqrtf(zmin*zmax); sceneView->setProjectionMatrixAsPerspective(45.0, aspectRatio, zmin, zmid); if (sceneViewFar.valid()) --- 2042,2049 ---- float aspectRatio = (float)windowSize.GetWidth() / (float)windowSize.GetHeight(); + float zmid = sqrtf(zmin*zmax); if (useFarSceneView) ! { sceneView->setProjectionMatrixAsPerspective(45.0, aspectRatio, zmin, zmid); if (sceneViewFar.valid()) *************** *** 2055,2058 **** --- 2057,2065 ---- } + if (databaseView.valid()) + { + databaseView->setProjectionMatrixAsPerspective(45.0, aspectRatio, zmin, zmid); + } + }  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-03-28 23:58:12
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9228/include/graphics Modified Files: tcButton.h tcDatabaseInfoWindow.h Log Message: Index: tcDatabaseInfoWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDatabaseInfoWindow.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcDatabaseInfoWindow.h 28 Mar 2006 02:44:45 -0000 1.3 --- tcDatabaseInfoWindow.h 28 Mar 2006 23:58:03 -0000 1.4 *************** *** 82,90 **** bool isDragable; ///< true if window can be dragged (moved) - void DrawDatabaseInfo(); bool FinishDestroy(); void UpdateWindowDrag(const wxPoint& pos); private: bool destroy; ///< workaround to delay destruction of window to safe time --- 82,95 ---- bool isDragable; ///< true if window can be dragged (moved) bool FinishDestroy(); void UpdateWindowDrag(const wxPoint& pos); private: + enum ViewMode + { + POPUP = 0, ///< compact view for popups + EMBED = 1 ///< mode for database viewer screen + } viewMode; ///< mode automatically selected based on hostParent argument to constructor + bool destroy; ///< workaround to delay destruction of window to safe time *************** *** 97,102 **** --- 102,112 ---- static tc3DWindow* parent; + void DrawDatabaseInfo(); + void DrawDatabaseImages(); database::tcDatabaseObject* GetDatabaseObject(); void LoadImageList(); + bool IsEmbedded() const; + bool IsPopup() const; + DECLARE_EVENT_TABLE() Index: tcButton.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcButton.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcButton.h 27 Mar 2006 01:08:30 -0000 1.15 --- tcButton.h 28 Mar 2006 23:58:03 -0000 1.16 *************** *** 60,63 **** --- 60,65 ---- void SetFontSize(float val); void SetForceDisable(bool state); + void SetMouseOverCaption(const std::string& s); + void SetMouseOverCaptionPosition(const wxPoint& pos); void SetOn(bool state) {isButtonOn = state;} void SetSendRedraw(bool state) {sendRedraw = state;} *************** *** 79,82 **** --- 81,87 ---- float backgroundAlpha; ///< transparency value for solid color background bool forceDisable; ///< if true then do not enable button + std::string mouseOverCaption; ///< additional caption to draw when mouse is over button + wxPoint mouseOverCaptionPosition; ///< location to draw mouse over caption at + osg::Vec4 offColor; *************** *** 96,99 **** --- 101,105 ---- static unsigned ref_count; + void DrawMouseOverCaption(); virtual void OnEnterWindow(wxMouseEvent& event); virtual void OnLButtonDown(wxMouseEvent& event);  | 
| 
     
      
      
      From: Dewitt C. <ddc...@us...> - 2006-03-28 23:58:07
      
     
   | 
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9228/include/sim Modified Files: Game.h Log Message: Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Game.h 27 Mar 2006 01:08:30 -0000 1.67 --- Game.h 28 Mar 2006 23:58:03 -0000 1.68 *************** *** 78,84 **** - #define SCREEN_XSIZE 1000 - #define SCREEN_YSIZE 720 - #define FONT_HEIGHT 50 #ifndef SCENARIO_PATH --- 78,81 ---- *************** *** 203,210 **** enum te3DSize { ! MODE3D_SMALL = 0, ///< corner view ! MODE3D_MEDIUM = 1, ///< size of tactical map ! MODE3D_FULL = 2, ///< full screen ! MODE3D_START = 3 ///< mode for start screen display }; enum teTacticalMapSize --- 200,208 ---- enum te3DSize { ! MODE3D_SMALL = 0, ///< corner view ! MODE3D_MEDIUM = 1, ///< size of tactical map ! MODE3D_FULL = 2, ///< full screen ! MODE3D_START = 3, ///< mode for start screen display ! MODE3D_DATABASE = 4 ///< mode for database viewer screen }; enum teTacticalMapSize  |