reman3/Rayman_X/cpa/tempgrp/GAM/P5/SnapShot.c

51 lines
1.5 KiB
C

#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Structur\EngMode.h"
#include "SnapShot.h"
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
extern void GAM_fn_vShowRasters();
#endif /* PRESS_DEMO */
#define C_NumberOfBytesPerPoint 3L
#define C_NumberOfBytesPerPointForGLI 3L
unsigned long g_ulNumberOfSnapShot = 0;
/*************************************************************************/
/* 14/04/98 Carlos Torres don't overwrite old snapshot*/
void fn_vGetAndSaveSnapShotOfScreenAsBMP(void)
{
char szFileName[_MAX_PATH];
unsigned char *p_ucBitmap;
DWORD dwWidth;
DWORD dwHeight;
dwWidth = g_stEngineStructure.stViewportAttr.dwWidth; /* 640*/
dwHeight = g_stEngineStructure.stViewportAttr.dwHeight; /* 480*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeSnapShot , 0 );
p_ucBitmap = TMP_M_p_Malloc( C_NumberOfBytesPerPointForGLI * dwHeight * dwWidth);
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
GAM_fn_vShowRasters();
#endif
GLD_vGetFrontBufferIn24BitsAA(g_stEngineStructure.hGLDDevice, g_stEngineStructure.hGLDViewport, dwWidth, dwHeight, p_ucBitmap);
do {
sprintf(szFileName,"SnapShot\\Snap%04d.bmp",g_ulNumberOfSnapShot++);
} while (FIL_fn_bIsFileExist(szFileName));
FIL_fn_vSaveBMPInFile(szFileName,p_ucBitmap, dwWidth, dwHeight, C_NumberOfBytesPerPoint, C_NumberOfBytesPerPointForGLI);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeSnapShot , 0 );
TMP_M_Free(p_ucBitmap);
}
/*************************************************************************/