MCPcopy Create free account
hub / github.com/bwapi/bwapi / _SDrawCaptureScreen

Function _SDrawCaptureScreen

bwapi/BWAPI/Source/Detours.cpp:297–324  ·  view source on GitHub ↗

--------------------------------------------- CAPTURE SCREEN -----------------------------------------------

Source from the content-addressed store, hash-verified

295}
296//--------------------------------------------- CAPTURE SCREEN -----------------------------------------------
297BOOL STORMAPI _SDrawCaptureScreen(const char *pszOutput)
298{
299 if ( !pszOutput )
300 return FALSE;
301
302 Util::Path newScreenFilename(pszOutput);
303
304 if ( !screenshotFmt.empty() ) // If an extension replacement was specified
305 newScreenFilename.replace_extension(screenshotFmt);
306
307 // Save the screenshot in w-mode
308 if ( wmode && pBits && isCorrectVersion )
309 {
310 // Create compatible palette
311 PALETTEENTRY pal[256];
312 for ( int i = 0; i < 256; ++i )
313 {
314 pal[i].peRed = wmodebmp.bmiColors[i].rgbRed;
315 pal[i].peGreen = wmodebmp.bmiColors[i].rgbGreen;
316 pal[i].peBlue = wmodebmp.bmiColors[i].rgbBlue;
317 pal[i].peFlags = 0;
318 }
319 return SBmpSaveImage(newScreenFilename.string().c_str(), pal, pBits, BW::BWDATA::GameScreenBuffer.width(), BW::BWDATA::GameScreenBuffer.height());
320 }
321 // Call the old fxn
322 auto SDrawCaptureScreenProc = _SDrawCaptureScreenOld ? _SDrawCaptureScreenOld : &SDrawCaptureScreen;
323 return SDrawCaptureScreenProc(newScreenFilename.string().c_str());
324}
325
326//----------------------------------------------- ON GAME END ------------------------------------------------
327BOOL __stdcall _SNetLeaveGame(int type)

Callers

nothing calls this directly

Calls 3

c_strMethod · 0.80
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected