[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.84,1.85 tcGameView.cpp,1.9,1.10 tcMapData.cpp,1.9,1.10 tc
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-06-21 22:22:16
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20597/src/sim Modified Files: Game.cpp tcGameView.cpp tcMapData.cpp tcMapView.cpp tcPopupControl.cpp tcSurfaceObject.cpp Log Message: Index: tcSurfaceObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcSurfaceObject.cpp 4 Jun 2004 21:39:23 -0000 1.10 --- tcSurfaceObject.cpp 21 Jun 2004 22:22:00 -0000 1.11 *************** *** 106,110 **** if (model) { ! model->SetSmokeMode(tcParticleEffect::DAMAGE); model->UpdateEffects(); } --- 106,117 ---- if (model) { ! if (mfDamageLevel > 0.1f) ! { ! model->SetSmokeMode(tcParticleEffect::DAMAGE); ! } ! else ! { ! model->SetSmokeMode(tcParticleEffect::OFF); ! } model->UpdateEffects(); } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** Game.cpp 19 Jun 2004 22:00:28 -0000 1.84 --- Game.cpp 21 Jun 2004 22:22:00 -0000 1.85 *************** *** 87,90 **** --- 87,91 ---- EVT_COMMAND(ID_SETPAUSE, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SetPauseMode) EVT_COMMAND(ID_SETTIMEACCEL, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SetTimeAccel) + EVT_COMMAND(ID_SETTHEATER, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SetTheater) EVT_COMMAND(ID_SET3D, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::Set3D) EVT_COMMAND(ID_SKIPBRIEFING, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SkipBriefing) *************** *** 445,449 **** mcMapData.AttachOptions(tcOptions::Get()); mcMapData.LoadLowRes(); ! mcMapData.LoadHighRes(-8.0f, 55.0f); // added mapdata reference to tcGameObject to allow RandInit() // to place objects at legal positions and to set altitude appropriately --- 446,452 ---- mcMapData.AttachOptions(tcOptions::Get()); mcMapData.LoadLowRes(); ! //mcMapData.LoadHighRes(-8.0f, 55.0f); ! mcMapData.LoadHighResB(-8.0f, 55.0f); ! // added mapdata reference to tcGameObject to allow RandInit() // to place objects at legal positions and to set altitude appropriately *************** *** 912,915 **** --- 915,919 ---- mcGameView.AttachSimState(simState); mcGameView.AttachMapView(tacticalMap); + mcGameView.AttachWorldMapView(worldMap); mcGameView.AttachUserInfo(&mcUserInfo); mcGameView.AttachOptions(tcOptions::Get()); *************** *** 1038,1041 **** --- 1042,1071 ---- /** + * wxWidgets event to call SetTheater + * extralong variable contains lat and lon, + * lowest 16 bits is longitude, next 16 bits is + * latitude, both in units of degrees. + */ + void tcGame::SetTheater(wxCommandEvent& event) + { + short int lon_deg = event.m_extraLong & 0xFFFF; + short int lat_deg = (event.m_extraLong >> 16) & 0xFFFF; + + SetTheater(lat_deg, lon_deg); + } + + /** + * Sets theater view center for tacticalMap. + */ + void tcGame::SetTheater(int lat_deg, int lon_deg) + { + mcMapData.LoadHighResB(float(lon_deg), float(lat_deg)); + if (tacticalMap) + { + tacticalMap->Refresh(); + } + } + + /** * Time acceleration mode change using a wxWindows event. * This is a more general version of SetPauseMode Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcMapView.cpp 19 Jun 2004 22:00:28 -0000 1.23 --- tcMapView.cpp 21 Jun 2004 22:22:00 -0000 1.24 *************** *** 183,188 **** } ! /***********************************************************************************/ ! // need to be modified to handle wrapped coordinates int tcMapView::PointInView(tcPoint& p) { --- 183,189 ---- } ! /** ! * needs to be modified to handle wrapped coordinates ! */ int tcMapView::PointInView(tcPoint& p) { *************** *** 190,193 **** --- 191,197 ---- (p.y >= mrectCurrentView.bottom)&&(p.y <= mrectCurrentView.top); } + + + /** * override of wxWindow::SetSize so that terrainView->SetSize is called as well *************** *** 242,246 **** tcWindow::SetActive(abActive); terrainView->SetActive(abActive); - wxWindow::Raise(); // without this, the world map view wasn't receiving mouse cmds } /***********************************************************************************/ --- 246,249 ---- *************** *** 1532,1536 **** mpMapData->GetTheaterArea(mrectViewBounds); // restrict view to theater area ! SetView(p,C_PIOVER180*32.0f); // Build symbologies BuildNTDS(); --- 1535,1539 ---- mpMapData->GetTheaterArea(mrectViewBounds); // restrict view to theater area ! SetView(p, C_PIOVER180*32.0f); // Build symbologies BuildNTDS(); *************** *** 1539,1542 **** --- 1542,1562 ---- /** + * Updates view bounds, sets current view to center, and refreshes (reloads) + * terrain view. + * This should be called after the map data theater area is changed. + */ + void tcTacticalMapView::Refresh() + { + wxASSERT(mpMapData); + + mpMapData->GetTheaterArea(mrectViewBounds); // restrict view to theater area + + tcPoint center(mrectViewBounds.XCenter(), mrectViewBounds.YCenter()); + SetView(center, C_PIOVER180*32.0f); + + RefreshTerrainView(); + } + + /** * OnLeaveWindow event handler */ *************** *** 1873,1876 **** --- 1893,1898 ---- int i; + mpMapData->GetTheaterArea(mrectTheater); // update box to indicate theater area + // done here to avoid artifacts from terrainview being out of sync with mapview terrainView->SetView(mrectCurrentView); *************** *** 1889,1894 **** } /**********************/ ! for(i=0;(i<(int)mnObjCount)&&(i<MAXWORLDMAPOBJ);i++) { ! if (maMapObj[i].mbExists) { DrawSymbol(pGraphics,&maMapObj[i]); } --- 1911,1918 ---- } /**********************/ ! for(i=0;(i<(int)mnObjCount)&&(i<MAXWORLDMAPOBJ);i++) ! { ! if (maMapObj[i].mbExists) ! { DrawSymbol(pGraphics,&maMapObj[i]); } *************** *** 1985,1989 **** { wxPoint point = event.GetPosition(); ! if (event.ControlDown()) { if (mfLonWidth > 30.0f*C_PIOVER180) --- 2009,2030 ---- { wxPoint point = event.GetPosition(); ! if (event.ControlDown() && event.ShiftDown()) ! { ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); ! tcPoint geoPoint = ScreenToGeo(point); // geopoint (lon,lat) in radians ! ! wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_SETTHEATER) ; ! command.SetEventObject(this); ! long lon = long(geoPoint.x * C_180OVERPI); ! long lat = long(geoPoint.y * C_180OVERPI); ! ! long coordField = (lat << 16) + (lon & 0xFFFF); ! command.m_extraLong = coordField; ! AddPendingEvent(command); ! ! ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); ! } ! else if (event.ControlDown()) { if (mfLonWidth > 30.0f*C_PIOVER180) *************** *** 2018,2021 **** --- 2059,2072 ---- mpointMouse = point; // TranslatePoint(point); } + + /** + * + */ + void tcWorldMapView::SetActive(bool abActive) + { + if (!IsActive()) wxWindow::Raise(); + tcMapView::SetActive(abActive); + } + /***********************************************************************************/ tcWorldMapView::tcWorldMapView(wxWindow *parent, Index: tcPopupControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPopupControl.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcPopupControl.cpp 4 Jan 2004 22:24:53 -0000 1.5 --- tcPopupControl.cpp 21 Jun 2004 22:22:00 -0000 1.6 *************** *** 186,189 **** --- 186,190 ---- } SetActive(true); + wxWindow::Raise(); mpointUpperLeft = point; // MoveWindow(point.x,point.y - (mpMenu->GetSize()-1)*mnItemHeight); // adjust mrectWindow to new popup menu location Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcMapData.cpp 20 Jun 2004 14:59:53 -0000 1.9 --- tcMapData.cpp 21 Jun 2004 22:22:00 -0000 1.10 *************** *** 222,225 **** --- 222,239 ---- } + /** + * Sets namestring to path + filename of 10 x 10 dem tile for northwest + * point of (lat_deg, lon_deg). lat_deg and lon_deg must be multiples + * of 10 to get a valid file name + */ + void tcMapData::GetTileName(wxString& nameString, int lat_deg, int lon_deg) + { + wxASSERT(lat_deg % 10 == 0); + wxASSERT(lon_deg % 10 == 0); + + nameString = mzDemPath.GetBuffer(); + nameString += wxString::Format("%dx%d.dat", lat_deg, lon_deg); + } + /********************************************************************/ // TODO: fix *************** *** 803,807 **** * point (startLon_deg, startLat_deg) * Uses newer 10 x 10 deg DEM tile system - * Forces the corner to a tile boundary */ void tcMapData::LoadHighResB(float startLon_deg, float startLat_deg) --- 817,820 ---- *************** *** 809,815 **** ConformLonLatDeg(startLon_deg, startLat_deg); ! // force corner point to a tile boundary ! startLon_deg = 0.5f * floorf(startLon_deg / 0.5f); ! startLat_deg = 0.5f * floorf(startLat_deg / 0.5f); } --- 822,870 ---- ConformLonLatDeg(startLon_deg, startLat_deg); ! float minLat_deg = -90.0f + M_HIGHRES * RESHIGH_DEG; ! if (startLat_deg < minLat_deg) startLat_deg = minLat_deg; ! ! // truncate to 0.5 deg multiple ! float n_lat_tiles = floorf(startLat_deg / 0.5f); ! float n_lon_tiles = floorf(startLon_deg / 0.5f); ! ! startLat_deg = 0.5f * n_lat_tiles; ! startLon_deg = 0.5f * n_lon_tiles; ! ! int northLat = 10 * (int)ceilf(startLat_deg / 10.0f); ! int southLat = northLat - 10; ! int westLon = 10 * (int)floorf(startLon_deg / 10.0f); ! int eastLon = westLon + 10; ! if (eastLon >= 180) eastLon -= 360; ! ! int lat_offset = ((180 - int(n_lat_tiles)) % 20) * 60; ! int lon_offset = ((int(n_lon_tiles) + 360) % 20) * 60; ! ! fprintf(stdout, "LoadHighResB - (%.1f x %.1f) -> N (%d) S (%d) W (%d) E(%d)\n", ! startLat_deg, startLon_deg, northLat, southLat, westLon, eastLon); ! ! // load DEM tile files ! tcFile tileNW, tileSW, tileNE, tileSE; ! LoadDemTile(tileNW, northLat, westLon); ! LoadDemTile(tileSW, southLat, westLon); ! LoadDemTile(tileNE, northLat, eastLon); ! LoadDemTile(tileSE, southLat, eastLon); ! ! ReadHighResData2(M_DEMTILE, N_DEMTILE, lat_offset, lon_offset, ! &tileNW, &tileNE, &tileSW, &tileSE); ! ! tileNW.Close(); ! tileSW.Close(); ! tileNE.Close(); ! tileSE.Close(); ! ! mrTheaterView.Set(C_PIOVER180*startLon_deg, ! C_PIOVER180*(startLon_deg+RESHIGH_DEG*N_HIGHRES), ! C_PIOVER180*(startLat_deg-RESHIGH_DEG*M_HIGHRES), ! C_PIOVER180*(startLat_deg)); ! ! fprintf(stdout, "tcMapData - LoadHighResB(lon %.1f, lat %.1f) - success\n", ! startLon_deg, startLat_deg); ! } *************** *** 1155,1167 **** ((fmrem)*(fnrem)*(float)maGlobal[m2][n2]); } ! /********************************************************************/ ! // high resolution terrain height (unless out of tiles) ! // TODO: consider changing this to use tiles that overlap (1 point border) to simplify the edge case ! float tcMapData::GetTerrainHeight(float afLon_deg, float afLat_deg, double afStatusTime) { float fm,fn,fmfloor,fnfloor,fmrem,fnrem; float h11,h12,h21,h22; long m1,n1,m2,n2,mtile,ntile; tsTileData *pTile, *pTileE, *pTileS, *pTileSE; ! enum _bcasetype { NORMAL, EAST_WEST, --- 1210,1232 ---- ((fmrem)*(fnrem)*(float)maGlobal[m2][n2]); } ! ! /** ! * Gets high resolution terrain height based on 30 arc-sec DEM ! * data. If high res data is not available, the low resolution map ! * is used instead. ! * This will call GetTile which first checks a cache of 0.5 x 0.5 deg ! * map "tiles". ! * TODO: consider changing this to use tiles that overlap (1 point border) ! * to simplify the edge case ! * @see tcMapData:GetTile ! */ ! float tcMapData::GetTerrainHeight(float afLon_deg, float afLat_deg, double afStatusTime) ! { float fm,fn,fmfloor,fnfloor,fmrem,fnrem; float h11,h12,h21,h22; long m1,n1,m2,n2,mtile,ntile; tsTileData *pTile, *pTileE, *pTileS, *pTileSE; ! enum _bcasetype ! { NORMAL, EAST_WEST, *************** *** 1171,1175 **** eeBorderCase = NORMAL; ! ConformLonLatDeg(afLon_deg,afLat_deg); fm = (90.0f-afLat_deg)*SCALE_HIGHRES; fn = (afLon_deg+180.0f)*SCALE_HIGHRES; --- 1236,1240 ---- eeBorderCase = NORMAL; ! ConformLonLatDeg(afLon_deg, afLat_deg); fm = (90.0f-afLat_deg)*SCALE_HIGHRES; fn = (afLon_deg+180.0f)*SCALE_HIGHRES; *************** *** 1186,1195 **** n1 -= ntile*N_TILE; m2 = (m1+1); ! if (m2==M_TILE) { m2=0; eeBorderCase = NORTH_SOUTH; } n2 = (n1+1); ! if (n2==N_TILE) { n2=0; eeBorderCase = (eeBorderCase==NORMAL) ? EAST_WEST : ALL_FOUR; --- 1251,1262 ---- n1 -= ntile*N_TILE; m2 = (m1+1); ! if (m2==M_TILE) ! { m2=0; eeBorderCase = NORTH_SOUTH; } n2 = (n1+1); ! if (n2==N_TILE) ! { n2=0; eeBorderCase = (eeBorderCase==NORMAL) ? EAST_WEST : ALL_FOUR; *************** *** 1197,1209 **** pTile = GetTile(mtile,ntile,afStatusTime); ! if (pTile==NULL) { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); } ! if (eeBorderCase != NORMAL) { h11 = (float)pTile->maMapData[m1][n1]; ! if (eeBorderCase == NORTH_SOUTH) { pTileS = GetTile(mtile+1,ntile,afStatusTime); ! if (pTileS == NULL) { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); --- 1264,1280 ---- pTile = GetTile(mtile,ntile,afStatusTime); ! if (pTile==NULL) ! { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); } ! if (eeBorderCase != NORMAL) ! { h11 = (float)pTile->maMapData[m1][n1]; ! if (eeBorderCase == NORTH_SOUTH) ! { pTileS = GetTile(mtile+1,ntile,afStatusTime); ! if (pTileS == NULL) ! { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); *************** *** 1213,1219 **** h22 = (float)pTileS->maMapData[m2][n2]; } ! if (eeBorderCase == EAST_WEST) { pTileE = GetTile(mtile,ntile+1,afStatusTime); ! if (pTileE == NULL) { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); --- 1284,1292 ---- h22 = (float)pTileS->maMapData[m2][n2]; } ! if (eeBorderCase == EAST_WEST) ! { pTileE = GetTile(mtile,ntile+1,afStatusTime); ! if (pTileE == NULL) ! { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); *************** *** 1223,1239 **** h22 = (float)pTileE->maMapData[m2][n2]; } ! if (eeBorderCase == ALL_FOUR) { pTileSE = GetTile(mtile+1,ntile+1,afStatusTime); ! if (pTileSE == NULL) { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); } pTileS = GetTile(mtile+1,ntile,afStatusTime); ! if (pTileS == NULL) { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); } pTileE = GetTile(mtile,ntile+1,afStatusTime); ! if (pTileE == NULL) { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); --- 1296,1316 ---- h22 = (float)pTileE->maMapData[m2][n2]; } ! if (eeBorderCase == ALL_FOUR) ! { pTileSE = GetTile(mtile+1,ntile+1,afStatusTime); ! if (pTileSE == NULL) ! { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); } pTileS = GetTile(mtile+1,ntile,afStatusTime); ! if (pTileS == NULL) ! { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); } pTileE = GetTile(mtile,ntile+1,afStatusTime); ! if (pTileE == NULL) ! { ReportMapDataError(ME_GENERIC); return GetTerrainHeightLowRes(afLon_deg, afLat_deg); *************** *** 1244,1248 **** } } ! else { h11 = (float)pTile->maMapData[m1][n1]; h12 = (float)pTile->maMapData[m1][n2]; --- 1321,1326 ---- } } ! else ! { h11 = (float)pTile->maMapData[m1][n1]; h12 = (float)pTile->maMapData[m1][n2]; *************** *** 1261,1265 **** //if (fHeight > -20.0f) {fHeight += 20.0f*sinf(100.0f*fnrem);} // test roughness function? ! if (fHeight == 0) { ReportMapDataError(ME_GENERIC); } --- 1339,1344 ---- //if (fHeight > -20.0f) {fHeight += 20.0f*sinf(100.0f*fnrem);} // test roughness function? ! if (fHeight == 0) ! { ReportMapDataError(ME_GENERIC); } *************** *** 1339,1342 **** --- 1418,1445 ---- } /** + * Loads 10 x 10 deg DEM tile specified by Northwest corner point + * (lat_deg, lon_deg). If tile does not exist no load takes place. + * @param lat_deg latitude of Northwest corner point in deg + * @param lat_deg should be mult of 10 deg between -80 and 90 + * @param lon_deg longitude of Northwest corner point in deg + * @param lon_deg should be mult of 10 deg between -180 and 170 + */ + void tcMapData::LoadDemTile(tcFile& tileFile, int lat_deg, int lon_deg) + { + static int errorCount = 0; + + wxString demTileName; + GetTileName(demTileName, lat_deg, lon_deg); + + if (tileFile.Open(demTileName.c_str(), tcFile::modeRead) ==0) + { + if ((errorCount < 10)||(errorCount++ % 100 == 0)) + { + fprintf(stderr, "Map tile not found: %s\n", demTileName.c_str()); + } + } + } + + /** * Loads 0.5 x 0.5 deg (default) tile from larger DEM tiles * @return populated tsTileData* or NULL if missing DEM data *************** *** 1487,1499 **** float fStartLon_deg = (float)ntile*SCALE_LOOKUP - 180.0f; ! wxString demTileName = mzDemPath.GetBuffer(); ! demTileName += wxString::Format("%dx%d.dat", lat_val, lon_val); ! ! if (demTile.Open(demTileName.c_str(), tcFile::modeRead) ==0) { - if (errorReports++ % 100 == 0) - { - fprintf(stderr, "Map tile not found: %s\n", demTileName.c_str()); - } return NULL; } --- 1590,1596 ---- float fStartLon_deg = (float)ntile*SCALE_LOOKUP - 180.0f; ! LoadDemTile(demTile, lat_val, lon_val); ! if (!demTile.IsOpen()) { return NULL; } *************** *** 1655,1658 **** --- 1752,1759 ---- s.Format("tcMapData size: %d kB",sizeof(tcMapData)/1024); WTL(s.GetBuffer()); + + //LoadHighResB(-1.0f, 12.0f); + //LoadHighResB(-89.0f, 175.0f); + } /********************************************************************/ Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcGameView.cpp 3 Apr 2004 20:24:33 -0000 1.9 --- tcGameView.cpp 21 Jun 2004 22:22:00 -0000 1.10 *************** *** 440,443 **** --- 440,447 ---- #endif + /** + * This method adds populated tcMapObj objects to the tactical and + * world map views. This is called once per frame. Needs refactoring. + */ void tcGameView::Update(double afStatusTime) { *************** *** 455,464 **** UINT8 nOtherAlliance = (nOwnAlliance == 1) ? 2 : 1; ! AddTruthTracks(nOwnAlliance,nMapObj,nWorldMapObj,FRIENDLY); ! if (nViewMode<2) { ! AddTruthTracks(nOtherAlliance,nMapObj,nWorldMapObj,HOSTILE); } ! if (nViewMode!=1) { ! AddSensorTracks(nOwnAlliance,nMapObj,nWorldMapObj,afStatusTime); } --- 459,470 ---- UINT8 nOtherAlliance = (nOwnAlliance == 1) ? 2 : 1; ! AddTruthTracks(nOwnAlliance, nMapObj, nWorldMapObj, FRIENDLY); ! if (nViewMode < 2) ! { ! AddTruthTracks(nOtherAlliance, nMapObj, nWorldMapObj, HOSTILE); } ! if (nViewMode != 1) ! { ! AddSensorTracks(nOwnAlliance, nMapObj, nWorldMapObj, afStatusTime); } *************** *** 470,485 **** tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(mpHookedObj); tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(mpHookedObj); ! if (pPlatformObj != NULL) { tnPoolIndex nTarget = pPlatformObj->mcAI.GetTarget(); ! if (nTarget != NULL_INDEX) { bShowTarget = mpSS->mcSensorMap.GetTrack(nTarget, track, nOwnAlliance); } } ! else if ((pMissileObj != NULL)&&(pMissileObj->mnAlliance == nOwnAlliance)) { bShowTarget = mpSS->GetSeekerTrack(mnHookID,track) != 0; } ! if(bShowTarget) { tcTrack predictedtrack; track.GetPrediction(predictedtrack,afStatusTime); --- 476,495 ---- tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(mpHookedObj); tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(mpHookedObj); ! if (pPlatformObj != NULL) ! { tnPoolIndex nTarget = pPlatformObj->mcAI.GetTarget(); ! if (nTarget != NULL_INDEX) ! { bShowTarget = mpSS->mcSensorMap.GetTrack(nTarget, track, nOwnAlliance); } } ! else if ((pMissileObj != NULL)&&(pMissileObj->mnAlliance == nOwnAlliance)) ! { bShowTarget = mpSS->GetSeekerTrack(mnHookID,track) != 0; } ! if (bShowTarget) ! { tcTrack predictedtrack; track.GetPrediction(predictedtrack,afStatusTime); *************** *** 504,508 **** tsOCSymbolList* pSymbolInfo; mpObjectControl->GetSymbols(pSymbolInfo); ! for(unsigned i=0;(i<pSymbolInfo->mnSymbols)&&(i<MAX_OCSYMBOLS)&&(nMapObj<MAXMAPOBJ);i++) { tcMapObj* pMO = &mpMapView->maMapObj[nMapObj++]; --- 514,520 ---- tsOCSymbolList* pSymbolInfo; mpObjectControl->GetSymbols(pSymbolInfo); ! for(unsigned i=0; ! (i<pSymbolInfo->mnSymbols)&&(i<MAX_OCSYMBOLS)&&(nMapObj<MAXMAPOBJ); ! i++) { tcMapObj* pMO = &mpMapView->maMapObj[nMapObj++]; *************** *** 524,528 **** mpMapView->mnObjCount = nMapObj; ! //* mpWorldMapView->mnObjCount = nWorldMapObj; // --------------- --- 536,540 ---- mpMapView->mnObjCount = nMapObj; ! mpWorldMapView->mnObjCount = nWorldMapObj; // --------------- *************** *** 538,542 **** } /******************************************************************************/ ! // add truth data to view for objects matching anAlliance void tcGameView::AddTruthTracks(unsigned int anAlliance, int& rnIndex, int& rnWorldIdx, teAffiliation aeAffiliation) --- 550,556 ---- } /******************************************************************************/ ! /** ! * add truth data to view for objects matching anAlliance ! */ void tcGameView::AddTruthTracks(unsigned int anAlliance, int& rnIndex, int& rnWorldIdx, teAffiliation aeAffiliation) *************** *** 574,578 **** int bAllianceMatch = (po->mnAlliance == anAlliance); ! if (bAllianceMatch&&(mpMapView->PointInView(point))&&(rnIndex < MAXMAPOBJ)) { mpSS->mpDatabase->mcObjectData.Lookup(po->mnDBKey,pdata); mpMapView->maMapObj[rnIndex].mbExists = 1; --- 588,593 ---- int bAllianceMatch = (po->mnAlliance == anAlliance); ! if (bAllianceMatch&&(mpMapView->PointInView(point))&&(rnIndex < MAXMAPOBJ)) ! { mpSS->mpDatabase->mcObjectData.Lookup(po->mnDBKey,pdata); mpMapView->maMapObj[rnIndex].mbExists = 1; *************** *** 587,592 **** rnIndex++; } ! #if 0 ! if (bAllianceMatch&&(mpWorldMapView->PointInView(point))&&(rnWorldIdx < MAXWORLDMAPOBJ)) { mpSS->mpDatabase->mcObjectData.Lookup(po->mnDBKey,pdata); mpWorldMapView->maMapObj[rnWorldIdx].mbExists = 1; --- 602,610 ---- rnIndex++; } ! ! bool updateWorldMap = mpWorldMapView && mpWorldMapView->IsActive() && ! mpWorldMapView->PointInView(point); ! if (updateWorldMap && bAllianceMatch && (rnWorldIdx < MAXWORLDMAPOBJ)) ! { mpSS->mpDatabase->mcObjectData.Lookup(po->mnDBKey,pdata); mpWorldMapView->maMapObj[rnWorldIdx].mbExists = 1; *************** *** 597,601 **** rnWorldIdx++; } ! #endif } --- 615,619 ---- rnWorldIdx++; } ! } *************** *** 612,615 **** --- 630,634 ---- tcSensorMapTrack *pSMTrack; int i = 0; + unsigned int nColor; while((i++<nSize)&&(rnIndex < MAXMAPOBJ)) *************** *** 647,650 **** --- 666,701 ---- mpMapView->maMapObj[rnIndex].mfLat = track.mfLat_rad; mpMapView->maMapObj[rnIndex].mnID = track.mnID; + + tcPoint point(track.mfLon_rad, track.mfLat_rad); + + bool updateWorldMap = mpWorldMapView && mpWorldMapView->IsActive() && + mpWorldMapView->PointInView(point); + if (updateWorldMap && (rnWorldIdx < MAXWORLDMAPOBJ)) + { + switch (affil) + { + case UNKNOWN: + nColor = 0xFFFFFF7F; + break; + case FRIENDLY: + nColor = 0xFF7DDDFF; + break; + case NEUTRAL: + nColor = 0xFFAAFFAA; + break; + case HOSTILE: + nColor = 0xFFFF8080; + break; + } + + mpWorldMapView->maMapObj[rnWorldIdx].mbExists = 1; + mpWorldMapView->maMapObj[rnWorldIdx].mnColor = nColor; + mpWorldMapView->maMapObj[rnWorldIdx].mfLon = track.mfLon_rad; + mpWorldMapView->maMapObj[rnWorldIdx].mfLat = track.mfLat_rad; + mpWorldMapView->maMapObj[rnWorldIdx].mnID = track.mnID; + rnWorldIdx++; + } + + /* tcGameObject *ptemp; |