X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGame.h;h=bda4324218e65af58dd42ad4b6109e2e8f3ad6cb;hb=24fc7ebc577b3452614208238bc3dd424fff14ad;hp=65cbaf1b00e5d33cd84d4a930a77dd024307f15c;hpb=0cca0c495c7dc29d134a10d7eed5de1f377c99bf;p=lugaru.git diff --git a/Source/Game.h b/Source/Game.h index 65cbaf1..bda4324 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -1,27 +1,58 @@ +/* +Copyright (C) 2003, 2010 - Wolfire Games + +This file is part of Lugaru. + +Lugaru is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + #ifndef _GAME_H_ #define _GAME_H_ -#ifndef WIN32 +#include "SDL.h" + +#if (defined(__APPLE__) && defined(__MACH__)) +# ifdef PLATFORM_MACOSX +# error Do not define PLATFORM_MACOSX for new builds. It is for the old Carbonized build. +# endif +#endif + +#ifdef PLATFORM_MACOSX #include #include "Quicktime.h" #endif + //Jordan included glut.h //#include #include "TGALoader.h" -#ifdef WIN32 + +#if !PLATFORM_MACOSX #include "WinInput.h" #else #include "Macinput.h" #endif + #include "Terrain.h" #include "Skybox.h" #include "Skeleton.h" -#include "Models.h" +#include "Models.h" #include "Lights.h" #include "Person.h" #include "Constants.h" -#include "fmod.h" #include "Sprites.h" //#include #include "Text.h" @@ -30,12 +61,11 @@ #include "Weapons.h" #include "binio.h" #include -#include "gl.h" +#include "gamegl.h" extern GLuint rabbittexture; - -class Game +class Game { public: @@ -73,7 +103,6 @@ public: int loaddistrib; int keyselect; int indemo; - int registered; bool won; @@ -208,16 +237,16 @@ public: bool oldattackkey; long long MD5_string (char *string); - static void LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha); - static void LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize); - void LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize); - bool AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize); + static void LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha); + static void LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize); + void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize); + bool AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize); void InitGame(); void LoadStuff(); void LoadingScreen(); void FadeLoadingScreen(float howmuch); void Dispose(); - int DrawGLScene(GLvoid); + int DrawGLScene(void); void Tick(); void TickOnce(); void TickOnceAfter(); @@ -246,25 +275,49 @@ public: int musicselected; int change; Game(); - ~Game() { + ~Game() { for(int i=0;i<10;i++){ - if(Mainmenuitems[i])glDeleteTextures( 1, (const unsigned long *)&Mainmenuitems[i] ); + if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] ); } - glDeleteTextures( 1, (const unsigned long *)&cursortexture ); - glDeleteTextures( 1, (const unsigned long *)&Maparrowtexture ); - glDeleteTextures( 1, (const unsigned long *)&Mapboxtexture ); - glDeleteTextures( 1, (const unsigned long *)&Mapcircletexture ); - glDeleteTextures( 1, (const unsigned long *)&terraintexture ); - glDeleteTextures( 1, (const unsigned long *)&terraintexture2 ); - if(screentexture>0)glDeleteTextures( 1, (const unsigned long *)&screentexture ); - if(screentexture2>0)glDeleteTextures( 1, (const unsigned long *)&screentexture2 ); - glDeleteTextures( 1, (const unsigned long *)&hawktexture ); - glDeleteTextures( 1, (const unsigned long *)&logotexture ); - glDeleteTextures( 1, (const unsigned long *)&loadscreentexture ); + glDeleteTextures( 1, &cursortexture ); + glDeleteTextures( 1, &Maparrowtexture ); + glDeleteTextures( 1, &Mapboxtexture ); + glDeleteTextures( 1, &Mapcircletexture ); + glDeleteTextures( 1, &terraintexture ); + glDeleteTextures( 1, &terraintexture2 ); + if(screentexture>0)glDeleteTextures( 1, &screentexture ); + if(screentexture2>0)glDeleteTextures( 1, &screentexture2 ); + glDeleteTextures( 1, &hawktexture ); + glDeleteTextures( 1, &logotexture ); + glDeleteTextures( 1, &loadscreentexture ); Dispose(); } }; -#endif \ No newline at end of file +#ifndef __forceinline +# ifdef __GNUC__ +# define __forceinline inline __attribute__((always_inline)) +# endif +#endif + +static __forceinline void swap_gl_buffers(void) +{ + + SDL_GL_SwapBuffers(); + +} + +#ifdef __GNUC__ +#define LONGLONGCONST(x) (x##ll) +#else +#define LONGLONGCONST(x) (x) +#endif + +extern "C" { void UndefinedSymbolToExposeStubbedCode(void); } +//#define STUBBED(x) UndefinedSymbolToExposeStubbedCode(); +#define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } } +//#define STUBBED(x) + +#endif