change pack alignment for opengl screenshot saving.

more useful error messages from ffread.cpp and language.c
This commit is contained in:
Steven Fuller 2002-11-30 01:41:25 +00:00 committed by Patryk Obara
parent e8789932e5
commit 03c87b518b
3 changed files with 33 additions and 11 deletions

View file

@ -34,6 +34,7 @@ static char *TextBufferPtr;
void InitTextStrings(void) void InitTextStrings(void)
{ {
char *filename;
char *textPtr; char *textPtr;
int i; int i;
@ -42,16 +43,26 @@ void InitTextStrings(void)
GLOBALASSERT(AvP.Language<I_MAX_NO_OF_LANGUAGES); GLOBALASSERT(AvP.Language<I_MAX_NO_OF_LANGUAGES);
#if MARINE_DEMO #if MARINE_DEMO
TextBufferPtr = LoadTextFile("menglish.txt"); filename = "menglish.txt";
#elif ALIEN_DEMO #elif ALIEN_DEMO
TextBufferPtr = LoadTextFile("aenglish.txt"); filename = "aenglish.txt";
#elif USE_LANGUAGE_TXT #elif USE_LANGUAGE_TXT
TextBufferPtr = LoadTextFile("language.txt"); filename = "language.txt";
#else #else
TextBufferPtr = LoadTextFile(LanguageFilename[AvP.Language]); filename = LanguageFilename[AvP.Language];
#endif #endif
TextBufferPtr = LoadTextFile(filename);
LOCALASSERT(TextBufferPtr); if (TextBufferPtr == NULL) {
/* NOTE:
if this load fails, then most likely the game is not
installed correctly.
SBF
*/
fprintf(stderr, "ERROR: unable to load %s language text file\n",
filename);
exit(1);
}
if (!strncmp (TextBufferPtr, "REBCRIF1", 8)) if (!strncmp (TextBufferPtr, "REBCRIF1", 8))
{ {

View file

@ -1,7 +1,12 @@
#ifdef WIN32
#include <windows.h>
#else
#include <errno.h>
#endif
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
//#include <windows.h>
#include <stdio.h> #include <stdio.h>
#include "ffread.hpp" #include "ffread.hpp"
@ -28,7 +33,7 @@ void ReportError(char const * mesg1, char const * mesg2)
} }
else else
{ {
#if 0 #ifdef WIN32
char * lpMsgBuf; char * lpMsgBuf;
err = GetLastError(); err = GetLastError();
@ -51,10 +56,15 @@ void ReportError(char const * mesg1, char const * mesg2)
// Free the buffer. // Free the buffer.
LocalFree( lpMsgBuf ); LocalFree( lpMsgBuf );
#endif #else
mesg = new char [strlen(mesg1)+32]; mesg2 = strerror(errno);
mesg = new char [strlen(mesg1)+32+strlen(mesg2)+1];
strcpy(mesg, mesg1); strcpy(mesg, mesg1);
strcat(mesg, "\n\nReportError: I have no clue!\n"); strcat(mesg, "\n\nReportError: ");
strcat(mesg, mesg2);
strcat(mesg, "\n");
#endif
} }
// Display the string. // Display the string.

View file

@ -182,6 +182,7 @@ unsigned char *GetScreenShot24(int *width, int *height)
buf = (unsigned char *)malloc(surface->w * surface->h * 3); buf = (unsigned char *)malloc(surface->w * surface->h * 3);
if (surface->flags & SDL_OPENGL) { if (surface->flags & SDL_OPENGL) {
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glReadPixels(0, 0, surface->w, surface->h, GL_RGB, GL_UNSIGNED_BYTE, buf); glReadPixels(0, 0, surface->w, surface->h, GL_RGB, GL_UNSIGNED_BYTE, buf);
} else { } else {