- Fix a crash with missing videos (by devurandom, slightly modified).
- Check if video mode could actually be set. - Clean up the lex/yacc generated files a bit. - Warning fixes. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@201 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
6cd530686f
commit
fd0ff3ccdb
|
@ -340,6 +340,7 @@ BOOL frameInitialise(HANDLE hInst, // The windows application instance
|
|||
{
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_CDROM) != 0)
|
||||
{
|
||||
printf("Error: Could not initialise SDL (%s).\n", SDL_GetError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,8 +127,6 @@ static int res__base[] = {
|
|||
618, 455, 490, 618, 172, 618
|
||||
};
|
||||
|
||||
|
||||
#line 1 "d:/usr/mks-ly/etc/yylex.c"
|
||||
/*
|
||||
* Copyright 1988, 1992 by Mortice Kern Systems Inc. All rights reserved.
|
||||
* All rights reserved.
|
||||
|
@ -256,8 +254,6 @@ extern void res_error YY_ARGS((char *fmt, ...));
|
|||
extern void res_comment YY_ARGS((char *term));
|
||||
extern int res_mapch YY_ARGS((int delim, int escape));
|
||||
|
||||
#line 1 "Resource.l"
|
||||
|
||||
/*
|
||||
* resource.l
|
||||
*
|
||||
|
@ -299,9 +295,6 @@ static UBYTE *pEndBuffer = NULL;
|
|||
#undef res_getc
|
||||
#define res_getc() (pInputBuffer != pEndBuffer ? *(pInputBuffer++) : EOF)
|
||||
|
||||
#line 127 "d:/usr/mks-ly/etc/yylex.c"
|
||||
|
||||
|
||||
#ifndef YYLMAX
|
||||
#define YYLMAX 100 /* token and pushback buffer size */
|
||||
#endif /* YYLMAX */
|
||||
|
@ -527,9 +520,6 @@ YYDECL {
|
|||
int res_oldi, res_oleng; /* base i, res_leng before look-ahead */
|
||||
int res_eof; /* 1 if eof has already been read */
|
||||
|
||||
#line 350 "d:/usr/mks-ly/etc/yylex.c"
|
||||
|
||||
|
||||
|
||||
#if !YY_STATIC_STDIO
|
||||
if (res_in == (FILE *)0)
|
||||
|
@ -651,15 +641,12 @@ YYDECL {
|
|||
YY_USER;
|
||||
switch (res__la_act[res_fmin] & 0777) {
|
||||
case 0:
|
||||
#line 64 "Resource.l"
|
||||
{ return DIRECTORY; }
|
||||
break;
|
||||
case 1:
|
||||
#line 65 "Resource.l"
|
||||
{ return FILETOKEN; }
|
||||
break;
|
||||
case 2:
|
||||
#line 68 "Resource.l"
|
||||
{
|
||||
strcpy(aText[currText], res_text);
|
||||
res_lval.sval = aText[currText];
|
||||
|
@ -668,19 +655,15 @@ YYDECL {
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
#line 76 "Resource.l"
|
||||
{ BEGIN QUOTE; }
|
||||
break;
|
||||
case 4:
|
||||
#line 77 "Resource.l"
|
||||
{ BEGIN 0; }
|
||||
break;
|
||||
case 5:
|
||||
#line 78 "Resource.l"
|
||||
{ res_error("Unexpected end of line in string"); }
|
||||
break;
|
||||
case 6:
|
||||
#line 79 "Resource.l"
|
||||
{
|
||||
strcpy(aText[currText], res_text);
|
||||
res_lval.sval = aText[currText];
|
||||
|
@ -689,7 +672,6 @@ YYDECL {
|
|||
}
|
||||
break;
|
||||
case 7:
|
||||
#line 85 "Resource.l"
|
||||
{
|
||||
aText[currText][0] = '\0';
|
||||
aText[currText][1] = '\0';
|
||||
|
@ -699,41 +681,32 @@ YYDECL {
|
|||
}
|
||||
break;
|
||||
case 8:
|
||||
#line 94 "Resource.l"
|
||||
;
|
||||
break;
|
||||
case 9:
|
||||
#line 97 "Resource.l"
|
||||
{ inComment=TRUE; BEGIN COMMENT; }
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
#line 99 "Resource.l"
|
||||
{ inComment=FALSE; BEGIN 0; }
|
||||
break;
|
||||
case 12:
|
||||
case 13:
|
||||
#line 101 "Resource.l"
|
||||
;
|
||||
break;
|
||||
case 14:
|
||||
#line 104 "Resource.l"
|
||||
{ BEGIN SLCOMMENT; }
|
||||
break;
|
||||
case 15:
|
||||
#line 105 "Resource.l"
|
||||
{ BEGIN 0; }
|
||||
break;
|
||||
case 16:
|
||||
#line 106 "Resource.l"
|
||||
;
|
||||
break;
|
||||
case 17:
|
||||
#line 109 "Resource.l"
|
||||
return res_text[0];
|
||||
break;
|
||||
|
||||
#line 472 "d:/usr/mks-ly/etc/yylex.c"
|
||||
|
||||
}
|
||||
YY_SCANNER;
|
||||
|
@ -770,8 +743,7 @@ typedef struct res__save_block_tag {
|
|||
} YY_SAVED;
|
||||
|
||||
YY_SAVED *
|
||||
res_SaveScan(fp)
|
||||
FILE * fp;
|
||||
res_SaveScan(FILE *fp)
|
||||
{
|
||||
YY_SAVED * p;
|
||||
|
||||
|
@ -798,8 +770,7 @@ FILE * fp;
|
|||
* Restore previous LEX state
|
||||
*/
|
||||
void
|
||||
res_RestoreScan(p)
|
||||
YY_SAVED * p;
|
||||
res_RestoreScan(YY_SAVED *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
return;
|
||||
|
@ -855,8 +826,7 @@ input()
|
|||
* pushback char
|
||||
*/
|
||||
YY_DECL int
|
||||
unput(c)
|
||||
int c;
|
||||
unput(int c)
|
||||
{
|
||||
#ifndef YY_PRESERVE
|
||||
if (res__end >= YYLMAX) {
|
||||
|
@ -882,8 +852,6 @@ unput(c)
|
|||
return c;
|
||||
}
|
||||
|
||||
#line 112 "Resource.l"
|
||||
|
||||
/* Set the current input buffer for the lexer */
|
||||
void resSetInputBuffer(UBYTE *pBuffer, UDWORD size)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include <string.h>
|
||||
|
||||
/* yacc -v -D Resource_y.h -p res_ -o Resource_y.c Resource.y */
|
||||
#ifdef YYTRACE
|
||||
#define YYDEBUG 1
|
||||
|
@ -48,8 +50,6 @@ typedef struct yyTypedRules_tag { /* Typed rule table */
|
|||
|
||||
#endif
|
||||
|
||||
#line 1 "Resource.y"
|
||||
|
||||
/*
|
||||
* resource.y
|
||||
*
|
||||
|
@ -194,8 +194,6 @@ typedef struct yyTraceItems_tag {
|
|||
} yyTraceItems;
|
||||
#endif
|
||||
|
||||
#line 2 "d:/usr/mks-ly/etc/yyparse.c"
|
||||
|
||||
/*
|
||||
* Copyright 1985, 1990 by Mortice Kern Systems Inc. All rights reserved.
|
||||
*
|
||||
|
@ -373,7 +371,6 @@ static char * yygetState YY_ARGS((int));
|
|||
#define yyassert(condition, msg, arg)
|
||||
#endif
|
||||
|
||||
#line 101 "Resource.y"
|
||||
/*
|
||||
* A simple error reporting routine
|
||||
*/
|
||||
|
@ -745,7 +742,6 @@ yyEncore:
|
|||
switch (yyi) { /* perform semantic action */
|
||||
|
||||
case YYr5: { /* dir_line : DIRECTORY QTEXT */
|
||||
#line 58 "Resource.y"
|
||||
|
||||
UDWORD len;
|
||||
|
||||
|
@ -775,7 +771,6 @@ case YYr5: { /* dir_line : DIRECTORY QTEXT */
|
|||
} break;
|
||||
|
||||
case YYr6: { /* file_line : FILETOKEN TEXT QTEXT */
|
||||
#line 88 "Resource.y"
|
||||
|
||||
|
||||
DBP1(("file: %s %s\n", yypvt[-1].sval, yypvt[0].sval));
|
||||
|
@ -785,7 +780,6 @@ case YYr6: { /* file_line : FILETOKEN TEXT QTEXT */
|
|||
}
|
||||
|
||||
} break;
|
||||
#line 314 "d:/usr/mks-ly/etc/yyparse.c"
|
||||
case YYrACCEPT:
|
||||
YYACCEPT;
|
||||
case YYrERROR:
|
||||
|
|
|
@ -187,8 +187,6 @@ static int strres__base[] = {
|
|||
593, 1130, 1130, 839, 874, 1130, 250, 1130
|
||||
};
|
||||
|
||||
|
||||
#line 1 "d:/usr/mks-ly/etc/yylex.c"
|
||||
/*
|
||||
* Copyright 1988, 1992 by Mortice Kern Systems Inc. All rights reserved.
|
||||
* All rights reserved.
|
||||
|
@ -316,8 +314,6 @@ extern void strres_error YY_ARGS((char *fmt, ...));
|
|||
extern void strres_comment YY_ARGS((char *term));
|
||||
extern int strres_mapch YY_ARGS((int delim, int escape));
|
||||
|
||||
#line 1 "StrRes.l"
|
||||
|
||||
/*
|
||||
* StrRes.l
|
||||
*
|
||||
|
@ -363,9 +359,6 @@ static UBYTE *pEndBuffer = NULL;
|
|||
#undef strres_getc
|
||||
#define strres_getc() (pInputBuffer != pEndBuffer ? *(pInputBuffer++) : EOF)
|
||||
|
||||
#line 127 "d:/usr/mks-ly/etc/yylex.c"
|
||||
|
||||
|
||||
#ifndef YYLMAX
|
||||
#define YYLMAX 100 /* token and pushback buffer size */
|
||||
#endif /* YYLMAX */
|
||||
|
@ -591,10 +584,6 @@ YYDECL {
|
|||
int strres_oldi, strres_oleng; /* base i, strres_leng before look-ahead */
|
||||
int strres_eof; /* 1 if eof has already been read */
|
||||
|
||||
#line 350 "d:/usr/mks-ly/etc/yylex.c"
|
||||
|
||||
|
||||
|
||||
#if !YY_STATIC_STDIO
|
||||
if (strres_in == (FILE *)0)
|
||||
strres_in = stdin;
|
||||
|
@ -715,7 +704,6 @@ YYDECL {
|
|||
YY_USER;
|
||||
switch (strres__la_act[strres_fmin] & 0777) {
|
||||
case 0:
|
||||
#line 69 "StrRes.l"
|
||||
{
|
||||
strcpy(aText[currText], strres_text);
|
||||
strres_lval.sval = aText[currText];
|
||||
|
@ -724,19 +712,15 @@ YYDECL {
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
#line 77 "StrRes.l"
|
||||
{ BEGIN QUOTE; }
|
||||
break;
|
||||
case 2:
|
||||
#line 78 "StrRes.l"
|
||||
{ BEGIN 0; }
|
||||
break;
|
||||
case 3:
|
||||
#line 79 "StrRes.l"
|
||||
{ strres_error("Unexpected end of line in string"); }
|
||||
break;
|
||||
case 4:
|
||||
#line 80 "StrRes.l"
|
||||
{
|
||||
strcpy(aText[currText], strres_text);
|
||||
strres_lval.sval = aText[currText];
|
||||
|
@ -745,42 +729,31 @@ YYDECL {
|
|||
}
|
||||
break;
|
||||
case 5:
|
||||
#line 88 "StrRes.l"
|
||||
;
|
||||
break;
|
||||
case 6:
|
||||
#line 91 "StrRes.l"
|
||||
{ inComment=TRUE; BEGIN COMMENT; }
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
#line 93 "StrRes.l"
|
||||
{ inComment=FALSE; BEGIN 0; }
|
||||
break;
|
||||
case 9:
|
||||
case 10:
|
||||
#line 95 "StrRes.l"
|
||||
;
|
||||
break;
|
||||
case 11:
|
||||
#line 98 "StrRes.l"
|
||||
{ BEGIN SLCOMMENT; }
|
||||
break;
|
||||
case 12:
|
||||
#line 99 "StrRes.l"
|
||||
{ BEGIN 0; }
|
||||
break;
|
||||
case 13:
|
||||
#line 100 "StrRes.l"
|
||||
;
|
||||
break;
|
||||
case 14:
|
||||
#line 103 "StrRes.l"
|
||||
return strres_text[0];
|
||||
break;
|
||||
|
||||
#line 472 "d:/usr/mks-ly/etc/yylex.c"
|
||||
|
||||
}
|
||||
YY_SCANNER;
|
||||
i = strres_leng;
|
||||
|
@ -816,8 +789,7 @@ typedef struct strres__save_block_tag {
|
|||
} YY_SAVED;
|
||||
|
||||
YY_SAVED *
|
||||
strres_SaveScan(fp)
|
||||
FILE * fp;
|
||||
strres_SaveScan(FILE *fp)
|
||||
{
|
||||
YY_SAVED * p;
|
||||
|
||||
|
@ -844,8 +816,7 @@ FILE * fp;
|
|||
* Restore previous LEX state
|
||||
*/
|
||||
void
|
||||
strres_RestoreScan(p)
|
||||
YY_SAVED * p;
|
||||
strres_RestoreScan(YY_SAVED *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
return;
|
||||
|
@ -901,8 +872,7 @@ input()
|
|||
* pushback char
|
||||
*/
|
||||
YY_DECL int
|
||||
unput(c)
|
||||
int c;
|
||||
unput(int c)
|
||||
{
|
||||
#ifndef YY_PRESERVE
|
||||
if (strres__end >= YYLMAX) {
|
||||
|
@ -928,8 +898,6 @@ unput(c)
|
|||
return c;
|
||||
}
|
||||
|
||||
#line 106 "StrRes.l"
|
||||
|
||||
/* Set the current input buffer for the lexer */
|
||||
void strresSetInputBuffer(UBYTE *pBuffer, UDWORD size)
|
||||
{
|
||||
|
|
|
@ -102,6 +102,7 @@ BOOL screenInitialise(UDWORD width, // Display width
|
|||
HANDLE hWindow) // The main windows handle
|
||||
{
|
||||
UDWORD i,j,k, index;
|
||||
int video_flags;
|
||||
|
||||
/* Store the screen information */
|
||||
screenWidth = width;
|
||||
|
@ -111,8 +112,12 @@ BOOL screenInitialise(UDWORD width, // Display width
|
|||
/* store vidmem flag */
|
||||
g_bVidMem = bVidMem;
|
||||
|
||||
screen = SDL_SetVideoMode(screenWidth, screenHeight, screenDepth, SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF);
|
||||
|
||||
video_flags = SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF;
|
||||
screen = SDL_SetVideoMode(screenWidth, screenHeight, screenDepth, video_flags);
|
||||
if (!screen) {
|
||||
printf("Error: SDL_SetVideoMode failed (%s).\n", SDL_GetError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If we're going to run in a palettised mode initialise the palette */
|
||||
if (bitDepth == PALETTISED_BITDEPTH)
|
||||
|
|
|
@ -952,7 +952,9 @@ static iBool _imd_load_points(UBYTE **ppFileData, UBYTE *FileDataEnd, iIMDShape
|
|||
int32 xmax, ymax, zmax;
|
||||
double dx, dy, dz, rad_sq, rad, old_to_p_sq, old_to_p, old_to_new;
|
||||
double xspan, yspan, zspan, maxspan;
|
||||
iVectorf dia1, dia2, vxmin, vymin, vzmin, vxmax, vymax, vzmax, cen;
|
||||
iVectorf dia1, dia2, cen;
|
||||
iVectorf vxmin = { 0, 0, 0 }, vymin = { 0, 0, 0 }, vzmin = { 0, 0, 0 },
|
||||
vxmax = { 0, 0, 0 }, vymax = { 0, 0, 0 }, vzmax = { 0, 0, 0 };
|
||||
|
||||
//load the points then pass through a second time to setup bounding datavalues
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ BOOL screenInitialise( UDWORD width, // Display width
|
|||
|
||||
{
|
||||
static int video_flags = 0;
|
||||
int bpp;
|
||||
|
||||
// Calculate the common flags for windowed and fullscreen modes.
|
||||
if (video_flags == 0) {
|
||||
|
@ -173,12 +174,25 @@ BOOL screenInitialise( UDWORD width, // Display width
|
|||
}
|
||||
|
||||
if (fullScreen) {
|
||||
screen = SDL_SetVideoMode(width, height, screenDepth, video_flags|SDL_FULLSCREEN);
|
||||
video_flags |= SDL_FULLSCREEN;
|
||||
screenMode = SCREEN_FULLSCREEN;
|
||||
} else {
|
||||
screen = SDL_SetVideoMode(width, height, screenDepth, video_flags/*|SDL_RESIZABLE*/);
|
||||
screenMode = SCREEN_WINDOWED;
|
||||
}
|
||||
|
||||
bpp = SDL_VideoModeOK(width, height, screenDepth, video_flags);
|
||||
if (bpp) {
|
||||
printf("Error: Video mode %dx%d@%dbpp is not supported!\n", width, height, screenDepth);
|
||||
return FALSE;
|
||||
}
|
||||
if (bpp != screenDepth) {
|
||||
printf("Warning: Using colour depth of %d instead of %d.\n", bpp, screenDepth);
|
||||
}
|
||||
screen = SDL_SetVideoMode(width, height, bpp, video_flags);
|
||||
if (!screen) {
|
||||
printf("Error: SDL_SetVideoMode failed (%s).\n", SDL_GetError());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
|
|
|
@ -163,11 +163,13 @@ BOOL seq_RenderVideoToBuffer( iSurface *pSurface, char *sequenceName, int time,
|
|||
|
||||
// check it exists. If not then try CD.
|
||||
pFileHandle = fopen(aVideoName, "rb");
|
||||
if (pFileHandle == NULL && bCDPath)
|
||||
if (pFileHandle == NULL)
|
||||
{
|
||||
ASSERT(((strlen(sequenceName) + strlen(aCDPath))<MAX_STR_LENGTH,"sequence path+name greater than max string"));
|
||||
strcpy(aVideoName,aCDPath);
|
||||
strcat(aVideoName,sequenceName);
|
||||
if (bCDPath) {
|
||||
ASSERT(((strlen(sequenceName) + strlen(aCDPath))<MAX_STR_LENGTH,"sequence path+name greater than max string"));
|
||||
strcpy(aVideoName,aCDPath);
|
||||
strcat(aVideoName,sequenceName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue