[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.85,1.86 tcDirector.cpp,1.6,1.7 tcDirectorEvent.cpp,1.6,1.
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-06-24 21:35:51
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23738/src/sim Modified Files: Game.cpp tcDirector.cpp tcDirectorEvent.cpp tcMapData.cpp tcMapView.cpp tcTerrainView.cpp Log Message: Index: tcDirector.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcDirector.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcDirector.cpp 29 Feb 2004 22:51:36 -0000 1.6 --- tcDirector.cpp 24 Jun 2004 21:35:41 -0000 1.7 *************** *** 2,6 **** ** tcDirector.cpp ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcDirector.cpp ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 31,39 **** #include "tcDirector.h" #include "tcDirectorEvent.h" - #include "tcMapView.h" #include "tcSound.h" #include "wxcommands.h" ! using MapView::tcMapView; /** --- 31,47 ---- #include "tcDirector.h" #include "tcDirectorEvent.h" #include "tcSound.h" #include "wxcommands.h" ! ! /** ! * static method to set static members for map views ! * ! * @see tcMapEvent::AttachMapViews ! */ ! void tcDirector::AttachMapViews(tcTacticalMapView* tmv, tcWorldMapView* wmv) ! { ! tcMapEvent::AttachMapViews(tmv, wmv); ! } /** *************** *** 80,99 **** AddEvent(new tcConsoleTextEvent("Engage enemy to the Northwest",5)); ! AddEvent(new tcMapViewEvent(mapView, 7, -5.9, 49.5, 4.0)); AddEvent(new tcSoundEffectEvent(7,SEFFECT_THUCK)); ! AddEvent(new tcMapTextEvent(mapView,"OPFOR",7.0,18.0f,-6.0, 49.9,1)); ! AddEvent(new tcConsoleTextEvent("",9)); ! AddEvent(new tcConsoleTextEvent("Enemy is believed to be a medium sized task force",9)); ! AddEvent(new tcConsoleTextEvent("similar in makeup to your own.",9)); ! AddEvent(new tcConsoleTextEvent("",12)); ! AddEvent(new tcConsoleTextEvent("Extreme caution is advised",12)); ! AddEvent(new tcConsoleTextEvent("",13)); ! AddEvent(new tcConsoleTextEvent("Good hunting",13)); AddEvent(new tcGameCommandEvent(ID_SETPAUSE, 18 , 0)); AddEvent(new tcGameCommandEvent(ID_SETBRIEFING, 18, 0)); AddEvent(new tcGameCommandEvent(ID_SET3D, 18, 1)); // deactivate 3D window ! //AddEvent(new tcMapViewEvent(mapView, 24, -5.9, 49.5, 4.0)); } --- 88,107 ---- AddEvent(new tcConsoleTextEvent("Engage enemy to the Northwest",5)); ! AddEvent(new tcMapViewEvent(7, -5.9, 49.5, 4.0)); AddEvent(new tcSoundEffectEvent(7,SEFFECT_THUCK)); ! AddEvent(new tcMapTextEvent("OPFOR", 7.0, 18.0f, -6.0, 49.9, 1)); ! AddEvent(new tcConsoleTextEvent("", 9)); ! AddEvent(new tcConsoleTextEvent("Enemy is believed to be a medium sized task force", 9)); ! AddEvent(new tcConsoleTextEvent("similar in makeup to your own.", 9)); ! AddEvent(new tcConsoleTextEvent("", 12)); ! AddEvent(new tcConsoleTextEvent("Extreme caution is advised", 12)); ! AddEvent(new tcConsoleTextEvent("", 13)); ! AddEvent(new tcConsoleTextEvent("Good hunting", 13)); AddEvent(new tcGameCommandEvent(ID_SETPAUSE, 18 , 0)); AddEvent(new tcGameCommandEvent(ID_SETBRIEFING, 18, 0)); AddEvent(new tcGameCommandEvent(ID_SET3D, 18, 1)); // deactivate 3D window ! //AddEvent(new tcMapViewEvent(24, -5.9, 49.5, 4.0)); } *************** *** 107,113 **** } ! tcDirector::tcDirector(tc3DViewer *view3D, tcMapView *mv, tcConsole *console , wxWindow *win) ! : mapView(mv), viewer(view3D) { tcConsoleTextEvent::AttachConsole(console); --- 115,121 ---- } ! tcDirector::tcDirector(tc3DViewer *view3D, tcConsole *console , wxWindow *win) ! : viewer(view3D) { tcConsoleTextEvent::AttachConsole(console); Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** Game.cpp 21 Jun 2004 22:22:00 -0000 1.85 --- Game.cpp 24 Jun 2004 21:35:41 -0000 1.86 *************** *** 647,652 **** wxASSERT(director == NULL); wxASSERT(tacticalMap); wxASSERT(briefingConsoleLeft); ! director = new tcDirector(viewer, tacticalMap, briefingConsoleLeft, this); director->SetStartTime(0); director->InitTest(); // load test event sequence --- 647,655 ---- wxASSERT(director == NULL); wxASSERT(tacticalMap); + wxASSERT(worldMap); wxASSERT(briefingConsoleLeft); ! ! tcDirector::AttachMapViews(tacticalMap, worldMap); ! director = new tcDirector(viewer, briefingConsoleLeft, this); director->SetStartTime(0); director->InitTest(); // load test event sequence *************** *** 715,724 **** { mrectWorldMap = mrectMap; ! mrectWorldMap.left = mrectWorldMap.right - 256; ! mrectWorldMap.top = mrectWorldMap.bottom - 128; worldMap = new tcWorldMapView(glCanvas, wxPoint(mrectWorldMap.left, mrectWorldMap.top), ! wxSize(mrectWorldMap.right - mrectWorldMap.left, ! mrectWorldMap.bottom - mrectWorldMap.top)); if (!worldMap) --- 718,727 ---- { mrectWorldMap = mrectMap; ! mrectWorldMap.left = mrectWorldMap.right - 257; ! mrectWorldMap.top = mrectWorldMap.bottom - 129; worldMap = new tcWorldMapView(glCanvas, wxPoint(mrectWorldMap.left, mrectWorldMap.top), ! wxSize(mrectWorldMap.right - mrectWorldMap.left - 1, ! mrectWorldMap.bottom - mrectWorldMap.top - 1)); if (!worldMap) *************** *** 1776,1779 **** --- 1779,1788 ---- if (chatBox->mbActive) chatBox->MoveToTop(); return; + case 'w': // toggle world map size + if (worldMap) + { + worldMap->ToggleMapSize(); + } + return; case 'A': accelerateTime--; Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcMapView.cpp 24 Jun 2004 01:43:44 -0000 1.25 --- tcMapView.cpp 24 Jun 2004 21:35:41 -0000 1.26 *************** *** 331,335 **** * Draws tactical map grid */ ! void tcTacticalMapView::DrawGrid(Graphics *apGraphics) { float lat,lon; --- 331,335 ---- * Draws tactical map grid */ ! void tcTacticalMapView::DrawGrid(Gdiplus::Graphics *apGraphics) { float lat,lon; *************** *** 356,360 **** * Draws tactical map scale bar */ ! void tcTacticalMapView::DrawScaleBar(Graphics *apGraphics) { float fKmPerPel, fKmScale; --- 356,360 ---- * Draws tactical map scale bar */ ! void tcTacticalMapView::DrawScaleBar(Gdiplus::Graphics *apGraphics) { float fKmPerPel, fKmScale; *************** *** 389,393 **** /***********************************************************************************/ ! void tcTacticalMapView::DrawTerrainText(Graphics *apGraphics) { tcPoint p; float fTerrainHeight_m; --- 389,394 ---- /***********************************************************************************/ ! void tcTacticalMapView::DrawTerrainText(Gdiplus::Graphics *apGraphics) ! { tcPoint p; float fTerrainHeight_m; *************** *** 396,400 **** if (apGraphics==NULL) {return;} p = ScreenToGeo(mpointMouse); ! fTerrainHeight_m = mpMapData->GetTerrainHeightLowRes(C_180OVERPI*p.x,C_180OVERPI*p.y); char ns; --- 397,406 ---- if (apGraphics==NULL) {return;} p = ScreenToGeo(mpointMouse); ! //fTerrainHeight_m = mpMapData->GetTerrainHeightLowRes(C_180OVERPI*p.x,C_180OVERPI*p.y); ! ! /* replaced with high res lookup, note converted to deg and then back in ! ** tcMapData::GetTerrainHeightHighRes ! */ ! fTerrainHeight_m = mpMapData->GetTerrainHeightHighRes(C_180OVERPI*p.x, C_180OVERPI*p.y); char ns; *************** *** 1900,1908 **** Erase(); ! if (!GetGraphics(pGraphics)) { ! //WTL("Failed to get Graphics in tcWorldMapView::Draw()\n"); return 0; } /*** Draw grid ***/ //DrawGrid(pGraphics); --- 1906,1922 ---- Erase(); ! if (!GetGraphics(pGraphics)) ! { return 0; } + if (mnWidth == iconSize) + { + DrawIcon(pGraphics); + ReleaseGraphics(pGraphics); + DrawBorder(); + return 1; + } + /*** Draw grid ***/ //DrawGrid(pGraphics); *************** *** 1950,1953 **** --- 1964,1978 ---- } } + + /** + * Draws icon version of world map + * TODO Eventually this should be moved up as a general function + * of tcWindow with ability to minimize, maximize, and reposition + * the window. + */ + void tcWorldMapView::DrawIcon(Gdiplus::Graphics* graphics) + { + } + /***********************************************************************************/ void tcWorldMapView::DrawTheaterBox(Gdiplus::Graphics *apGraphics) *************** *** 2008,2011 **** --- 2033,2057 ---- SetView(p, C_PIOVER180*340.0f); } + + /** + * Posts message to change tactical map theater + */ + void tcWorldMapView::ChangeTheater(float lon_deg, float lat_deg) + { + // center on requested location + const float c1 = 0.5f * C_180OVERPI; + lon_deg -= c1 * mrectTheater.Width(); + lat_deg += c1 * mrectTheater.Height(); + + wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_SETTHEATER) ; + command.SetEventObject(this); + long lon = long(lon_deg); + long lat = long(lat_deg); + + long coordField = (lat << 16) + (lon & 0xFFFF); + command.m_extraLong = coordField; + AddPendingEvent(command); + } + /***********************************************************************************/ void tcWorldMapView::OnLButtonDown(wxMouseEvent& event) *************** *** 2017,2033 **** tcPoint geoPoint = ScreenToGeo(point); // geopoint (lon,lat) in radians ! // center new theater on clicked location ! geoPoint.x -= 0.5f * mrectTheater.Width(); ! geoPoint.y += 0.5f * mrectTheater.Height(); ! ! 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); --- 2063,2067 ---- tcPoint geoPoint = ScreenToGeo(point); // geopoint (lon,lat) in radians ! ChangeTheater(C_180OVERPI * geoPoint.x, C_180OVERPI * geoPoint.y); tcSound::Get()->PlayEffect(SEFFECT_BEEP2); *************** *** 2076,2084 **** } ! /***********************************************************************************/ tcWorldMapView::tcWorldMapView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) { terrainView = new tcTerrainView(parent, pos, size, false); --- 2110,2134 ---- } ! /** ! * ! */ ! void tcWorldMapView::ToggleMapSize() ! { ! if (IsWindowMinimized()) ! { ! tcWindow::Maximize(); ! terrainView->Maximize(); ! } ! else ! { ! tcWindow::Minimize(); ! terrainView->Minimize(); ! } ! } ! tcWorldMapView::tcWorldMapView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) { terrainView = new tcTerrainView(parent, pos, size, false); *************** *** 2089,2094 **** ClearMapObjects(); } ! /***********************************************************************************/ ! tcWorldMapView::~tcWorldMapView() { } --- 2139,2145 ---- ClearMapObjects(); } ! ! tcWorldMapView::~tcWorldMapView() ! { } Index: tcTerrainView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTerrainView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcTerrainView.cpp 24 Jun 2004 01:43:44 -0000 1.10 --- tcTerrainView.cpp 24 Jun 2004 21:35:41 -0000 1.11 *************** *** 47,50 **** --- 47,63 ---- } + /** + * If the terrain view is minimized always force + * abActive to false + */ + void tcTerrainView::SetActive(bool abActive) + { + if (IsWindowMinimized()) + { + tcWindow::SetActive(false); + } + tcWindow::SetActive(abActive); + } + /** * update display region of mp2DSurface *************** *** 164,167 **** --- 177,189 ---- } + /** + * call tcWindow::SetActive(false) on Minimize() + */ + void tcTerrainView::Minimize() + { + tcWindow::SetActive(false); + tcWindow::Minimize(); + } + int tcTerrainView::RefreshSurfaces() { Index: tcDirectorEvent.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcDirectorEvent.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcDirectorEvent.cpp 29 Feb 2004 22:51:36 -0000 1.6 --- tcDirectorEvent.cpp 24 Jun 2004 21:35:41 -0000 1.7 *************** *** 67,77 **** /********** tcMapEvent ****************/ /** ! * @param map pointer to tcMapView window that event applies to * @param obj pointer to tcMapObject graphical map object */ ! tcMapEvent::tcMapEvent(tcMapView *map, tcMapObject *obj) ! : mapView(map), mapObject(obj), addedToMap(false) { } --- 67,90 ---- /********** tcMapEvent ****************/ + tcTacticalMapView* tcMapEvent::tacticalMapView = 0; + tcWorldMapView* tcMapEvent::worldMapView = 0; + + void tcMapEvent::AttachMapViews(tcTacticalMapView* tmv, tcWorldMapView* wmv) + { + tacticalMapView = tmv; + worldMapView = wmv; + } + /** ! * static method tcMapEvent::AttachMapViews must be called first ! * ! * @see tcMapEvent::AttachMapViews * @param obj pointer to tcMapObject graphical map object */ ! tcMapEvent::tcMapEvent(tcMapObject *obj) ! : mapObject(obj), addedToMap(false) { + wxASSERT(tacticalMapView); + wxASSERT(worldMapView); } *************** *** 93,97 **** { wxASSERT(mapObject); ! mapView->AddMapObject(mapObject); addedToMap = true; } --- 106,110 ---- { wxASSERT(mapObject); ! tacticalMapView->AddMapObject(mapObject); addedToMap = true; } *************** *** 126,132 **** ! tcMapTextEvent::tcMapTextEvent(tcMapView *map, std::string text, double startTime, double endTime, double lon_deg, double lat_deg, int effect) ! : tcMapEvent(map, new tcMapTextObject(text, lon_deg, lat_deg)) , tcDirectorEvent(startTime, endTime) { --- 139,145 ---- ! tcMapTextEvent::tcMapTextEvent(std::string text, double startTime, double endTime, double lon_deg, double lat_deg, int effect) ! : tcMapEvent(new tcMapTextObject(text, lon_deg, lat_deg)) , tcDirectorEvent(startTime, endTime) { *************** *** 278,282 **** /*************** tcMapViewEvent ***************/ ! void tcMapViewEvent::Update(double t) { --- 291,303 ---- /*************** tcMapViewEvent ***************/ ! /** ! * For lonSpan_rad = 0 theater view is changed ! * via the world map ! * For lonSpan_rad > 0 the tactical map view is ! * changed. ! * ! * @see tcTacticalMapView::SetView ! * @see tcWorldMapView::ChangeTheater ! */ void tcMapViewEvent::Update(double t) { *************** *** 284,300 **** if (triggered) return; ! wxASSERT(mapView); tcPoint pCenter; pCenter.x = lon_rad; pCenter.y = lat_rad; ! mapView->SetView(pCenter,lonSpan_rad); triggered = true; } ! tcMapViewEvent::tcMapViewEvent(tcMapView *map, double t, double lon_deg, double lat_deg, double lonSpan_deg) ! : tcMapEvent(map, NULL) , tcDirectorEvent(t, t) { lon_rad = C_PIOVER180 * lon_deg; --- 305,330 ---- if (triggered) return; ! wxASSERT(tacticalMapView); ! wxASSERT(worldMapView); tcPoint pCenter; pCenter.x = lon_rad; pCenter.y = lat_rad; ! ! if (lonSpan_rad > 0) ! { ! tacticalMapView->SetView(pCenter, lonSpan_rad); ! } ! else ! { ! worldMapView->ChangeTheater(C_180OVERPI*lon_rad, C_180OVERPI*lat_rad); ! } triggered = true; } ! tcMapViewEvent::tcMapViewEvent(double t, double lon_deg, double lat_deg, double lonSpan_deg) ! : tcMapEvent(NULL) , tcDirectorEvent(t, t) { lon_rad = C_PIOVER180 * lon_deg; Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcMapData.cpp 24 Jun 2004 01:43:44 -0000 1.11 --- tcMapData.cpp 24 Jun 2004 21:35:41 -0000 1.12 *************** *** 392,395 **** --- 392,439 ---- void tcMapData::DarkenLowResUnavailable(UINT32* imageData) { + int M, N; + UINT32 nAlphaOffset = 0xFE000000; + M = M_LOWRES; + N = N_LOWRES; + int lowResScale = int(SCALE_LOWRES); + int lowResDemTileWidth = demTileReader->GetTileWidth() / K_DEC_LOWRES; + int lowResDemTileHeight = demTileReader->GetTileHeight() / K_DEC_LOWRES; + + wxASSERT(imageData); + if (imageData == NULL) {return;} + + for (int lat = -80; lat <= 90; lat += 10) + { + for (int lon = -180; lon <=170; lon += 10) + { + /* if tile is not available, darken corresponding area + ** of low res map + */ + if (!demTileReader->IsTileAvailable(lat, lon)) + { + int mstart = (90-lat) * lowResScale; + int nstart = (180+lon) * lowResScale; + for (int m = mstart; m < mstart + lowResDemTileHeight; m++) + { + for (int n = nstart; n < nstart + lowResDemTileWidth; n++) + { + unsigned long idx = (M-1-m)*N + n; + unsigned long red = ((imageData[idx] & 0x000000FF) / 4) + & 0x000000FF; + unsigned long green = ((imageData[idx] & 0x0000FF00) / 4) + & 0x0000FF00; + unsigned long blue = ((imageData[idx] & 0x00FF0000) / 4) + & 0x00FF0000; + unsigned long darkened = nAlphaOffset + red + green + blue; + + imageData[idx] = darkened; + } + } + } + } + + } + + fprintf(stdout, "tcMapData - Darkened unavailable tiles\n"); } *************** *** 891,896 **** fMain.Close(); ! mrTheaterView.Set(C_PIOVER180*afStartLon_deg,C_PIOVER180*(afStartLon_deg+RESHIGH_DEG*N_HIGHRES), ! C_PIOVER180*(afStartLat_deg-RESHIGH_DEG*M_HIGHRES),C_PIOVER180*(afStartLat_deg)); tcString s; --- 935,947 ---- fMain.Close(); ! mrTheaterView.Set(C_PIOVER180*afStartLon_deg, ! C_PIOVER180*(afStartLon_deg+RESHIGH_DEG*N_HIGHRES), ! C_PIOVER180*(afStartLat_deg-RESHIGH_DEG*M_HIGHRES), ! C_PIOVER180*(afStartLat_deg)); ! ! theaterViewDeg.Set(afStartLon_deg, ! (afStartLon_deg+RESHIGH_DEG*N_HIGHRES), ! (afStartLat_deg-RESHIGH_DEG*M_HIGHRES), ! afStartLat_deg); tcString s; *************** *** 962,969 **** 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); --- 1013,1025 ---- 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)); + theaterViewDeg.Set(startLon_deg, + (startLon_deg + RESHIGH_DEG*N_HIGHRES), + (startLat_deg - RESHIGH_DEG*M_HIGHRES), + startLat_deg); + fprintf(stdout, "tcMapData - LoadHighResB(lon %.1f, lat %.1f) - success\n", startLon_deg, startLat_deg); *************** *** 1039,1044 **** ! mrTheaterView.Set(C_PIOVER180*afStartLon_deg,C_PIOVER180*(afStartLon_deg+RESHIGH_DEG*N_HIGHRES), ! C_PIOVER180*(afStartLat_deg-RESHIGH_DEG*M_HIGHRES),C_PIOVER180*(afStartLat_deg)); tcString s; --- 1095,1107 ---- ! mrTheaterView.Set(C_PIOVER180*afStartLon_deg, ! C_PIOVER180*(afStartLon_deg+RESHIGH_DEG*N_HIGHRES), ! C_PIOVER180*(afStartLat_deg-RESHIGH_DEG*M_HIGHRES), ! C_PIOVER180*(afStartLat_deg)); ! ! theaterViewDeg.Set(afStartLon_deg, ! (afStartLon_deg+RESHIGH_DEG*N_HIGHRES), ! (afStartLat_deg-RESHIGH_DEG*M_HIGHRES), ! afStartLat_deg); tcString s; *************** *** 1168,1176 **** } */ ! if (anMapID==0) { ! //LabelLowRes(); // TODO: add country and geopol labels } ! WTL("tcMapData - CreateMapImage - success"); } --- 1231,1243 ---- } */ ! // for low res map, darken the unavailable tiles ! if (anMapID == 0) ! { ! DarkenLowResUnavailable(apData); } ! //LabelLowRes(); // TODO: add country and geopol labels ! ! fprintf(stdout, "tcMapData - CreateMapImage - success\n"); } *************** *** 1363,1373 **** WTL("tcMapData - CreateHighResMapImage - success"); } ! /********************************************************************/ ! // low resolution version ! float tcMapData::GetTerrainHeightLowRes(float afLon_deg, float afLat_deg) { float fm,fn,fmfloor,fnfloor,fmrem,fnrem; int m1,n1,m2,n2; ! ConformLonLatDeg(afLon_deg,afLat_deg); fm = (90.0f-afLat_deg)*SCALE_LOWRES; fn = (afLon_deg+180.0f)*SCALE_LOWRES; --- 1430,1496 ---- WTL("tcMapData - CreateHighResMapImage - success"); } ! ! /** ! * Uses the high res map to get the terrain height. This does ! * not use the 0.5 x 0.5 tiles and will not load tiles to cache ! * map data. ! * @see tcMapData::GetTerrainHeight ! * @see tcMapData::GetTerrainHeightLowRes ! * ! * @return terrain height based on high resolution world map ! */ ! float tcMapData::GetTerrainHeightHighRes(float afLon_deg, float afLat_deg) ! { float fm,fn,fmfloor,fnfloor,fmrem,fnrem; int m1,n1,m2,n2; ! ConformLonLatDeg(afLon_deg, afLat_deg); ! ! if (!mrTheaterView.ContainsPoint(C_PIOVER180*afLon_deg, ! C_PIOVER180*afLat_deg)) ! { ! static unsigned errCount = 0; ! if (errCount++ < 16) ! { ! fprintf(stderr, "GetTerrainHeightHighRes - " ! "point out of theater\n"); ! } ! return -999.0f; ! } ! ! float theaterWestLon_deg = theaterViewDeg.left; ! float theaterNorthLat_deg = theaterViewDeg.top; ! ! ! fm = (theaterNorthLat_deg-afLat_deg)*SCALE_HIGHRES; ! fn = (afLon_deg-theaterWestLon_deg)*SCALE_HIGHRES; ! fmfloor = floorf(fm); ! fnfloor = floorf(fn); ! fmrem = fm - fmfloor; ! fnrem = fn - fnfloor; ! ! m1 = (int)fmfloor; ! n1 = (int)fnfloor; ! m2 = (m1+1); ! m2 %= M_HIGHRES; ! n2 = (n1+1); ! n2 %= N_HIGHRES; ! ! return ((1.0f-fmrem)*(1.0f-fnrem)*(float)maTheater[m1][n1]) + ! ((1.0f-fmrem)*(fnrem)*(float)maTheater[m1][n2]) + ! ((fmrem)*(1.0f-fnrem)*(float)maTheater[m2][n1]) + ! ((fmrem)*(fnrem)*(float)maTheater[m2][n2]); ! } ! ! ! /** ! * @return terrain height based on low resolution world map ! */ ! float tcMapData::GetTerrainHeightLowRes(float afLon_deg, float afLat_deg) ! { ! float fm,fn,fmfloor,fnfloor,fmrem,fnrem; ! int m1,n1,m2,n2; ! ! ConformLonLatDeg(afLon_deg, afLat_deg); fm = (90.0f-afLat_deg)*SCALE_LOWRES; fn = (afLon_deg+180.0f)*SCALE_LOWRES; |