From 9a32158ae895b2be5736ecb942dcf1c1046d5033 Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Thu, 6 Dec 2001 01:33:14 +0000 Subject: [PATCH] Screenshots in software mode (menus) implemented. --- README | 13 +++++++------ TODO | 2 +- src/main.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/README b/README index 79bda48..64423bd 100644 --- a/README +++ b/README @@ -41,14 +41,19 @@ windows/vmware (read below to find out why), or download the AvP Alien demo. If you are wanting to run the Alien demo (the installer is an .exe but you can just use unzip to extract the files from the .exe), add -DALIEN_DEMO to the CFLAGS line (the one that's uncommented) in the Makefile. Rename all game -files lowercase. Be sure to install SDL 1.2 (http://www.libsdl.org), nasm -0.98, and the latest OpenAL CVS (http://www.openal.org). +files lowercase. Be sure to install SDL 1.2 (http://www.libsdl.org) with +OpenGL support, nasm 0.98, and the latest OpenAL CVS (http://www.openal.org). +AvP requires a 3d card with OpenGL support to work. Create the MPConfig and User_Profiles directories if they do not exist. (Note: Windows profiles probably do not work in Linux and vice versa) If you have the regular edition, add -DREGULAR_EDITION to CFLAGS. +If the version you want to use is not the Gold Edition, download +http://www.icculus.org/avp/english.txt.gz, extract it, and rename it +language.txt (Regular Ed.) or aenglish.txt (Alien Demo). + If you get "Aborted" after starting a new game the second time or so, try recompiling with gcc-3.0.2. It seems to have fixed it for me, but I'll try to find a workaround that works with gcc-2.95. @@ -67,10 +72,6 @@ MPConfig/ User_Profiles/ Support for the demo is not quite complete (some sounds are missing and some text is incorrect/missing). -If the version you want to use is not the Gold Edition, download -http://www.icculus.org/avp/english.txt.gz, extract it, and rename it -language.txt (Regular Ed.) or aenglish.txt (Alien Demo). - Linux Port-specific commands: - ALT-ENTER for fullscreen diff --git a/TODO b/TODO index 3bb9c95..26881d2 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,7 @@ [DONE] [08/26/01] Fix sound code. [DONE] [11/10/01] Save/Load Game support. [DONE] [11/25/01] CD Audio. -* Menus. +[DONE] [12/05/01] Menus. * Progress bar. * Make vidmodes work. * Debug "pure virtual method called" diff --git a/src/main.c b/src/main.c index b2a6d7c..87a895e 100644 --- a/src/main.c +++ b/src/main.c @@ -99,7 +99,36 @@ unsigned char *GetScreenShot24(int *width, int *height) glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glReadPixels(0, 0, surface->w, surface->h, GL_RGB, GL_BYTE, buf); } else { - fprintf(stderr, "GetScreenShot24: add software mode 16->24!\n"); + unsigned char *ptrd; + unsigned short int *ptrs; + int x, y; + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + free(buf); + return NULL; /* ... */ + } + } + + ptrd = buf; + for (y = 0; y < surface->h; y++) { + ptrs = (unsigned short *)(((unsigned char *)surface->pixels) + (surface->h-y-1)*surface->pitch); + for (x = 0; x < surface->w; x++) { + unsigned int c; + + c = *ptrs; + ptrd[0] = (c & 0xF800)>>8; + ptrd[1] = (c & 0x07E0)>>3; + ptrd[2] = (c & 0x001F)<<3; + + ptrs++; + ptrd += 3; + } + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } } *width = surface->w;