From bef1facdbc73741ef34e88fe7d496944a6119391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Andersson?= Date: Tue, 23 Sep 2003 16:13:13 +0000 Subject: [PATCH] Removed the screenshot code. (The SDL backend already has the ability to make screenshots.) svn-id: r10382 --- sword2/driver/d_draw.cpp | 183 --------------------------------------- sword2/driver/driver96.h | 1 - sword2/driver/rdwin.cpp | 5 -- sword2/sword2.cpp | 6 +- 4 files changed, 4 insertions(+), 191 deletions(-) diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp index a893c5ef7fb..a56e764114b 100644 --- a/sword2/driver/d_draw.cpp +++ b/sword2/driver/d_draw.cpp @@ -169,189 +169,6 @@ int32 EraseBackBuffer( void ) { } - - -int32 SaveScreenShot(uint8 *buffer, uint8 *palette) -{ - - static uint16 pcxCount = 0; - int virtualWidth; - int pix; - int keyPix; - int line; - int i; - int runLength; - char filename[80]; - unsigned char ch; - unsigned char *pcxData; - unsigned char pal[256*3]; - FILE *fp; - _pcxHeader pcxHead; - - sprintf(filename, "snap%.4d.pcx", pcxCount); - - fp = fopen(filename, "wb"); - if (fp == NULL) - { - sprintf(filename, "c:\\snap%.4d.pcx", pcxCount); - fp = fopen(filename, "wb"); - if (fp == NULL) - { - return(0); - } - } - pcxCount += 1; - - // Set up and write the header - pcxHead.manufacturer = 0x0a; - pcxHead.version = 5; - pcxHead.encoding = 1; - pcxHead.bitsPerPixel = 8; - pcxHead.xmin = 0; - pcxHead.ymin = 0; - pcxHead.xmax = 639; - pcxHead.ymax = 479; - pcxHead.hres = 72; - pcxHead.vres = 72; - pcxHead.reserved = 0; - pcxHead.colourPlanes = 1; - pcxHead.bytesPerLine = 640; - pcxHead.paletteType = 1; - fwrite(&pcxHead , sizeof(pcxHead), 1, fp); - - // The simplest job is to write out the entire file as a series of single units - - virtualWidth = 640; -// char *pcxDataBase = buffer; //GetBitMap() + (GetHeight()-1)* virtualWidth ; - for (line = 0 ; line < 480; line++) - { - pcxData = (unsigned char *)buffer; //pcxDataBase; - - // Look to compress this line of 'width' pixels - pix = 0; - while (pix < 640) - { // Look for some run length coding - keyPix = pcxData[pix++]; - runLength = 1; - while ( (pix < 640) && (keyPix == pcxData[pix]) ) - { runLength++; - pix++; - } - while (runLength > 1) - { // We have a run length bit. Runs are a maximum of 0x3f - int lRun = runLength > 0x3f ? 0x3f : runLength; - runLength -= lRun; - lRun |= 0xc0; - ch = (unsigned char) lRun; - fwrite(&ch, 1, 1, fp); - ch = (unsigned char) keyPix; - fwrite(&ch, 1, 1, fp); -// fFile.WriteChar(lRun); -// fFile.WriteChar(keyPix); - } - if (runLength) - { // Single pixel. If its <= 0x3f it goes straight in, otherwise it is a single run length - if (keyPix < 0xc0) - { - ch = (unsigned char) keyPix; - fwrite(&ch, 1, 1, fp); -// fFile.WriteChar(keyPix); - } - else - { - ch = 0xc1; - fwrite(&ch, 1, 1, fp); - ch = (unsigned char) keyPix; - fwrite(&ch, 1, 1, fp); -// fFile.WriteChar(0xc1); -// fFile.WriteChar(keyPix); - } - } - } -// pcxDataBase -= virtualWidth; - buffer += virtualWidth; - } - - // Convert and write out the palette -// StringClass sPal(768); -// unsigned char *pal = palette; -// for (int count = 0 ; count < 256 ; count++) -// { *(pal++) = bmi.bmiColors[count].rgbRed; -// *(pal++) = bmi.bmiColors[count].rgbGreen; -// *(pal++) = bmi.bmiColors[count].rgbBlue; -// } - ch = 0x0c; - fwrite(&ch, 1, 1, fp); - - for (i=0; i<256*3; i++) - { - pal[i] = *((unsigned char *) palette + i); - } - -// fFile.WriteChar(0x0c); - fwrite(pal, 256*3, 1, fp); -// if (fFile.Write(sPal , 768)!=768) -// return(-1); - fclose(fp); - - return(1); - -} - -int32 GrabScreenShot(void) { - warning("stub GrabScreenShot"); -/* - uint8 *screenGrabBuffer; - uint8 *palette; - DDSURFACEDESC ddsd; - HRESULT hr; - int32 i; - - - screenGrabBuffer = (uint8 *) malloc(screenWide * screenDeep); - if (screenGrabBuffer == NULL) - return(RDERR_OUTOFMEMORY); - - ddsd.dwSize = sizeof(DDSURFACEDESC); - hr = IDirectDrawSurface2_Lock(lpPrimarySurface, NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL); - if (hr != DD_OK) - { - free(screenGrabBuffer); - return(RDERR_LOCKFAILED); - } - - for (i=0; ipoll_event(&event)) { switch(event.event_code) { - case OSystem::EVENT_KEYDOWN: - if (event.kbd.flags==OSystem::KBD_CTRL) { - if (event.kbd.keycode == 'w') - GrabScreenShot(); - } WriteKey(event.kbd.ascii, event.kbd.keycode, event.kbd.flags); break; case OSystem::EVENT_MOUSEMOVE: diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index bdfbc899612..e18193fe9e9 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -342,8 +342,10 @@ void Sword2State::go() { ServiceWindows(); #ifdef _SWORD2_DEBUG - if (grabbingSequences && !console_status) - GrabScreenShot(); +// FIXME: If we want this, we should re-work it to use the backend's +// screenshot functionality. +// if (grabbingSequences && !console_status) +// GrabScreenShot(); #endif // if we are closing down the game, break out of main game loop