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)
{
char *filename;
char *textPtr;
int i;
@ -42,17 +43,27 @@ void InitTextStrings(void)
GLOBALASSERT(AvP.Language<I_MAX_NO_OF_LANGUAGES);
#if MARINE_DEMO
TextBufferPtr = LoadTextFile("menglish.txt");
filename = "menglish.txt";
#elif ALIEN_DEMO
TextBufferPtr = LoadTextFile("aenglish.txt");
filename = "aenglish.txt";
#elif USE_LANGUAGE_TXT
TextBufferPtr = LoadTextFile("language.txt");
filename = "language.txt";
#else
TextBufferPtr = LoadTextFile(LanguageFilename[AvP.Language]);
filename = LanguageFilename[AvP.Language];
#endif
TextBufferPtr = LoadTextFile(filename);
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);
}
LOCALASSERT(TextBufferPtr);
if (!strncmp (TextBufferPtr, "REBCRIF1", 8))
{
textPtr = (char*)HuffmanDecompress((HuffmanPackage*)(TextBufferPtr));

View file

@ -1,7 +1,12 @@
#ifdef WIN32
#include <windows.h>
#else
#include <errno.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
//#include <windows.h>
#include <stdio.h>
#include "ffread.hpp"
@ -28,7 +33,7 @@ void ReportError(char const * mesg1, char const * mesg2)
}
else
{
#if 0
#ifdef WIN32
char * lpMsgBuf;
err = GetLastError();
@ -51,10 +56,15 @@ void ReportError(char const * mesg1, char const * mesg2)
// Free the buffer.
LocalFree( lpMsgBuf );
#endif
mesg = new char [strlen(mesg1)+32];
#else
mesg2 = strerror(errno);
mesg = new char [strlen(mesg1)+32+strlen(mesg2)+1];
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.

View file

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