Fixed infinite loop in splash when image not found + code cleanup

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2277 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: dd5aceafd3d35723a4d03eb8c8b4c1cb15e520cd
Former-commit-id: f779b01298d4b779151d3943f75b14cdc53113c0
This commit is contained in:
pouillot 2010-02-28 15:12:52 +00:00
parent 407668c306
commit 2ffdd9d5ca
10 changed files with 40 additions and 46 deletions

View file

@ -5,9 +5,10 @@ ENDIF(NOT DEFINED IN_SOURCETREE)
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF(WIN32)
SET(CMAKE_INSTALL_PREFIX "C:/Program files/speed-dreams-dev" CACHE PATH "Prefix prepended to install directories" FORCE)
ELSE()
ELSE()
SET(CMAKE_INSTALL_PREFIX "/usr/local/dev" CACHE PATH "Prefix prepended to install directories" FORCE)
ENDIF()
MESSAGE(STATUS "Default install prefix : $CMAKE_INSTALL_PREFIX")
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF(NOT SOURCE_DIR AND IN_SOURCETREE)

View file

@ -21,12 +21,7 @@
#ifndef _CLIENT_H_
#define _CLIENT_H_
#if _WIN32
#include <windows.h>
#endif
extern void GameEntry(void);
extern bool GameEntry(void);
#endif /* _CLIENT_H_ */

View file

@ -18,8 +18,7 @@
***************************************************************************/
#include "client.h"
#include "mainmenu.h"
#include "tgfclient.h"
#include "splash.h"
/*
@ -27,23 +26,23 @@
* GameEntry
*
* Description
* entry point of the game
* Entry point of the game.
*
* Parameters
* none
* None
*
* Return
* none
* true on success, false in anything bad happened.
*
* Remarks
*
*/
void
bool
GameEntry(void)
{
// Initialize gaming framework.
// Initialize gaming framework.
GfInitClient();
// Open the splash screen, load menus in "backgroud" and finally open the main menu.
SplashScreen();
// Open the splash screen, load menus in "backgroud" and finally open the main menu.
return SplashScreen();
}

View file

@ -240,28 +240,29 @@ static void splashMouse(int /* b */, int s, int /* x */, int /* y */)
/*
* Function
*
* SplashScreen
*
* Description
*
* Display the splash screen and load the main menus in the background.
* On mouse click or 7 second time-out, open the main menu.
*
* Parameters
*
* None
*
* Return
*
* true on success, false in anything bad happened.
*
* Remarks
*
*/
int SplashScreen(void)
bool SplashScreen(void)
{
void *handle;
float screen_gamma;
//const char *filename = "data/img/splash.png";
const char *filename = "data/img/splash.jpg";
if (s_texture != 0)
if (s_texture)
{
glDeleteTextures(1, &s_texture);
}
@ -276,7 +277,7 @@ int SplashScreen(void)
{
GfParmReleaseHandle(handle);
GfTrace("Couldn't load splash screen image %s\n", filename);
return -1;
return false;
}
glGenTextures(1, &s_texture);
@ -294,6 +295,6 @@ int SplashScreen(void)
sdlMouseFunc(splashMouse);
sdlIdleFunc(splashIdle);
return 0;
return true;
}

View file

@ -21,11 +21,7 @@
#ifndef _SPLASH_H_
#define _SPLASH_H_
#if _WIN32
#include <windows.h>
#endif
extern int SplashScreen(void);
extern bool SplashScreen(void);
#endif /* _SPLASH_H_ */

View file

@ -1627,10 +1627,10 @@ GfParmWriteFile (const char *file, void *parmHandle, const char *name)
fputs (line, fout);
}
GfOut ("GfParmWriteFile: %s file written\n", file);
fclose (fout);
GfOut ("Wrote %s (%p)\n", file, parmHandle);
return 0;
}

View file

@ -19,6 +19,7 @@
#ifndef _GUI_H__
#define _GUI_H__
#include "tgfclient.h"
#include "guifont.h"
#define GFUI_COLORNB 26

View file

@ -16,13 +16,8 @@
* *
***************************************************************************/
#ifdef WIN32
#include <windows.h>
#endif
#include "tgfclient.h"
#include <time.h>
#include "gui.h"
#include "tgfclient.h"
extern void gfScreenInit(void);
extern void gfMenuInit(void);

View file

@ -133,10 +133,13 @@ main(int argc, char *argv[])
GfScrInit(argc, argv); /* init screen */
GameEntry(); /* launch the game */
if (GameEntry()) /* launch the game */
{
sdlMainLoop(); /* Main event loop */
exit(0);
}
sdlMainLoop(); /* SDL event loop */
return 0; /* just for the compiler, never reached */
GfError("\nExiting from Speed Dreams for some fatal reason (see above).\n");
exit(1); /* If we got here, something bad happened ... */
}

View file

@ -180,10 +180,13 @@ main(int argc, char *argv[])
GfScrInit(argc, argv); /* init screen */
GameEntry(); /* launch the game */
sdlMainLoop(); /* event loop of sdl */
return 0; /* just for the compiler, never reached */
if (GameEntry()) /* launch the game */
{
sdlMainLoop(); /* Main event loop */
exit(0);
}
GfError("\nExiting from Speed Dreams for some fatal reason (see above).\n");
exit(1); /* If we got here, something bad happened ... */
}