| 36 | BITMAPINFO256 wmodebmp; |
| 37 | HBITMAP hwmodeBmp; |
| 38 | void InitializeWModeBitmap(int width, int height) |
| 39 | { |
| 40 | if ( hdcMem ) |
| 41 | DeleteDC(hdcMem); |
| 42 | hdcMem = NULL; |
| 43 | |
| 44 | // Create Bitmap HDC |
| 45 | MemZero(wmodebmp); |
| 46 | wmodebmp.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); |
| 47 | wmodebmp.bmiHeader.biWidth = width; |
| 48 | wmodebmp.bmiHeader.biHeight = -(height); |
| 49 | wmodebmp.bmiHeader.biPlanes = 1; |
| 50 | wmodebmp.bmiHeader.biBitCount = 8; |
| 51 | wmodebmp.bmiHeader.biCompression = BI_RGB; |
| 52 | wmodebmp.bmiHeader.biSizeImage = width * height; |
| 53 | #ifndef SHADOW_BROODWAR |
| 54 | if ( isCorrectVersion ) |
| 55 | { |
| 56 | for ( int i = 0; i < 256; ++i ) |
| 57 | { |
| 58 | wmodebmp.bmiColors[i].rgbRed = BW::BWDATA::GamePalette[i].peRed; |
| 59 | wmodebmp.bmiColors[i].rgbGreen = BW::BWDATA::GamePalette[i].peGreen; |
| 60 | wmodebmp.bmiColors[i].rgbBlue = BW::BWDATA::GamePalette[i].peBlue; |
| 61 | } |
| 62 | } |
| 63 | #endif |
| 64 | HDC hdc = GetDC(ghMainWnd); |
| 65 | hwmodeBmp = CreateDIBSection(hdc, (BITMAPINFO*)&wmodebmp, DIB_RGB_COLORS, &pBits, NULL, 0); |
| 66 | hdcMem = CreateCompatibleDC(hdc); |
| 67 | ReleaseDC(ghMainWnd, hdc); |
| 68 | SelectObject(hdcMem, hwmodeBmp); |
| 69 | } |
| 70 | |
| 71 | void GetBorderRect(HWND hWnd, LPRECT lpRect) |
| 72 | { |