[Gcblue-commits] gcb_wx/src/sim tcMapData.cpp,1.22,1.23
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-07-16 23:13:16
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26502/src/sim Modified Files: tcMapData.cpp Log Message: Fix for horizon darkening bug, option cleanup Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcMapData.cpp 2 Jul 2005 16:51:12 -0000 1.22 --- tcMapData.cpp 16 Jul 2005 23:12:38 -0000 1.23 *************** *** 234,372 **** ! ! /********************************************************************/ ! // TODO: fix ! #if 0 ! void tcMapData::UpdateSurface(LPDIRECTDRAWSURFACE apDDS, tcRect view) { ! DDSURFACEDESC ddsd; ! HRESULT hr; ! HDC hdc; ! int nWidth,nHeight; ! RECT aDest[2],aSource[2], rDestHR, rSourceHR; ! int n,nBlockCount,bHRBlt; ! DDBLTFX fx; ! ! ddsd.dwSize = sizeof(DDSURFACEDESC); ! apDDS->GetSurfaceDesc(&ddsd); ! nWidth = ddsd.dwWidth; ! nHeight = ddsd.dwHeight; ! memset(&fx,0,sizeof(fx)); ! fx.dwSize = sizeof(DDBLTFX); ! fx.dwFillColor = 0x000000; ! ! if ((mpOptions!=NULL)&&(mpOptions->mnMapMode!=mnCurrentMapMode)) { ! mnCurrentMapMode = mpOptions->mnMapMode; ! CreateMapImage(mnCurrentMapMode,0); ! CreateMapImage(mnCurrentMapMode,1); ! } ! ! nBlockCount = GetLowResBltList(view, nWidth, nHeight, aSource, aDest); ! if (nBlockCount > 2) {nBlockCount = 2;} ! ! for(n=0;n<nBlockCount;n++) { ! hr = apDDS->Blt(&aDest[n],mpDDS_LowRes,&aSource[n],DDBLT_WAIT ,&fx); ! if (hr != DD_OK) { ! apDDS->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&fx); // blt black if error ! } ! } ! ! bHRBlt = GetHighResBltList(view, nWidth, nHeight, &rSourceHR, &rDestHR); ! ! if (bHRBlt) { ! hr = apDDS->Blt(&rDestHR,mpDDS_HighRes,&rSourceHR,DDBLT_WAIT ,&fx); ! if (hr != DD_OK) { ! apDDS->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&fx); // blt black if error ! } ! } ! ! /***** draw text debug info *****/ ! hr = apDDS->GetDC(&hdc); ! if ((hdc==NULL)||(hr != DD_OK)) {WTL("Failed to get DC");return;} ! ! if ((mpOptions != NULL)&&(mpOptions->mbShowMapDebug)) { ! //HFONT hFontOld = (HFONT)SelectObject(hdc,mhFontDefault); ! SetBkColor(hdc, RGB(0, 0, 0)); ! SetBkMode(hdc, TRANSPARENT); ! SetTextColor(hdc, RGB(255, 255, 255)); ! tcString sText; ! sText.Format("(%3.1f,%3.1f lon) (%3.1f,%3.1f lat)", ! view.left,view.right,view.bottom,view.top); ! TextOut(hdc,50, 100, sText, sText.GetLength()); ! ! sText.Format("(%3.1f,%3.1f lon) (%3.1f,%3.1f lat) (HR)", ! mrTheaterView.left,mrTheaterView.right,mrTheaterView.bottom,mrTheaterView.top); ! TextOut(hdc,50, 120, sText, sText.GetLength()); ! ! for(n=0;n<nBlockCount;n++) { ! sText.Format("block %d src: (LRTB) %d %d %d %d -> dest: %d %d %d %d ",n, ! aSource[n].left,aSource[n].right,aSource[n].top,aSource[n].bottom, ! aDest[n].left,aDest[n].right,aDest[n].top,aDest[n].bottom); ! TextOut(hdc,50, 140 + 20*n, sText, sText.GetLength()); ! } ! ! if (bHRBlt) { ! sText.Format("(LRTB) %d %d %d %d -> dest: %d %d %d %d (HR)", ! rSourceHR.left,rSourceHR.right,rSourceHR.top,rSourceHR.bottom, ! rDestHR.left,rDestHR.right,rDestHR.top,rDestHR.bottom); ! TextOut(hdc,50, 180, sText, sText.GetLength()); ! } ! } ! ! /***** draw theater box *****/ ! float fLonSpan_deg = view.Width(); ! float fLatSpan_deg = view.Height(); ! float fLatScale = (float)nHeight/fLatSpan_deg; ! float fLonScale = (float)nWidth/fLonSpan_deg; ! int x1 = (int)((mrTheaterView.left - view.left)*fLonScale); ! int x2 = (int)((mrTheaterView.right - view.left)*fLonScale); ! int y1 = (int)((view.top - mrTheaterView.bottom)*fLatScale); ! int y2 = (int)((view.top - mrTheaterView.top)*fLonScale); ! HPEN mhPenOld = (HPEN)SelectObject(hdc,mhPenBox); ! MoveToEx(hdc,x1,y1,NULL); ! LineTo(hdc,x2,y1); ! LineTo(hdc,x2,y2); ! LineTo(hdc,x1,y2); ! LineTo(hdc,x1,y1); ! SelectObject(hdc,mhPenOld); ! //SelectObject(hdc,hFontOld); ! apDDS->ReleaseDC(hdc); ! } ! ! /********************************************************************/ ! int tcMapData::CreateOffscreen(LPDIRECTDRAW apDD) ! { ! DDSURFACEDESC ddsd; ! HRESULT hr; ! ! /***** Create offscreen low resolution global map *****/ ! memset(&ddsd,0,sizeof(ddsd)); ! ddsd.dwSize = sizeof(ddsd); ! ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; ! ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; ! ddsd.dwWidth = N_LOWRES; ! ddsd.dwHeight = M_LOWRES; ! ! hr = apDD->CreateSurface(&ddsd, &mpDDS_LowRes, NULL); ! if(hr != DD_OK) { ! AfxMessageBox("Error - tcMapData - CreateOffscreen (mpDDS_LowRes)"); ! return false; ! } ! ddsd.dwWidth = N_HIGHRES; ! ddsd.dwHeight = M_HIGHRES; ! ! hr = apDD->CreateSurface(&ddsd, &mpDDS_HighRes, NULL); ! if(hr != DD_OK) { ! AfxMessageBox("Error - tcMapData - CreateOffscreen (mpDDS_HighRes)"); ! return false; ! } ! return true; ! } ! /********************************************************************/ ! void tcMapData::ReleaseOffscreen() { ! if (mpDDS_LowRes != NULL) {mpDDS_LowRes->Release();} ! if (mpDDS_HighRes != NULL) {mpDDS_HighRes->Release();} ! } ! #endif ! /********************************************************************/ void tcMapData::CreatePalettes() { --- 234,240 ---- ! /** ! * ! */ void tcMapData::CreatePalettes() { |