From: Ryan C. Gordon Date: Fri, 5 Aug 2005 13:49:28 +0000 (+0000) Subject: More work. X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=8562aa5bebc97ea8a61d056aec3847030c6985b7;p=lugaru.git More work. --- diff --git a/Source/Frustum.cpp b/Source/Frustum.cpp index 9ddaa10..f3ab44e 100644 --- a/Source/Frustum.cpp +++ b/Source/Frustum.cpp @@ -1,7 +1,7 @@ #include "Frustum.h" #include -#include "gl.h" +#include "gamegl.h" void FRUSTUM:: diff --git a/Source/Game.h b/Source/Game.h index 65cbaf1..6a7644c 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -2,15 +2,21 @@ #define _GAME_H_ #ifndef WIN32 +#ifdef PLATFORM_MACOSX #include #include "Quicktime.h" #endif +#endif + //Jordan included glut.h //#include #include "TGALoader.h" #ifdef WIN32 #include "WinInput.h" +#elif USE_SDL +#include "SDL.h" +//#include "SDLInput.h" #else #include "Macinput.h" #endif @@ -30,7 +36,7 @@ #include "Weapons.h" #include "binio.h" #include -#include "gl.h" +#include "gamegl.h" extern GLuint rabbittexture; @@ -248,19 +254,19 @@ public: 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(); } diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index e3cd41b..5ea481a 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -15,8 +15,12 @@ extern float fadestart; extern float screenwidth,screenheight; #ifdef WIN32 extern HDC hDC; -#else +#elif PLATFORM_MACOSX extern AGLContext gaglContext; +#elif USE_SDL +extern SDL_Surface *sdlscreen; +#else +#error please define your platform. #endif extern int kTextureSize; extern FRUSTUM frustum; @@ -162,6 +166,12 @@ extern FSOUND_SAMPLE *samp[100]; extern int channels[100]; extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); +#ifdef __GNUC__ +#define LONGLONGCONST(x) (x##ll) +#else +#define LONGLONGCONST(x) (x) +#endif + /*********************> DrawGLScene() <*****/ long long Game::MD5_string (char *string){ char temp[256]=""; @@ -181,11 +191,11 @@ long long Game::MD5_string (char *string){ num=abs(num); if(num==0)num+=1452; - while(num<5000000000000000){ + while(num9900000000000000){ + while(num>LONGLONGCONST(9900000000000000)){ num/=1.235421521; } @@ -282,7 +292,7 @@ int Game::DrawGLScene(GLvoid) color2.red=0; color2.green=0; color2.blue=0; -#ifndef WIN32 +#if PLATFORM_MACOSX DSpContext_FadeGamma(NULL,200,&color2); #endif } diff --git a/Source/Globals.cpp b/Source/Globals.cpp index 0a4c6d2..f5598e7 100644 --- a/Source/Globals.cpp +++ b/Source/Globals.cpp @@ -1,4 +1,4 @@ -#include "gl.h" +#include "gamegl.h" #include "Quaternions.h" #include "Lights.h" #include "Skeleton.h" diff --git a/Source/Lights.h b/Source/Lights.h index 32d9f56..ef98337 100644 --- a/Source/Lights.h +++ b/Source/Lights.h @@ -3,7 +3,7 @@ /**> HEADER FILES <**/ -#include "gl.h" +#include "gamegl.h" #include "Quaternions.h" class Light{ diff --git a/Source/Models.h b/Source/Models.h index 2f1da97..6154d6f 100644 --- a/Source/Models.h +++ b/Source/Models.h @@ -5,7 +5,7 @@ // // Model Maximums // -#include "gl.h" +#include "gamegl.h" #include #include #include diff --git a/Source/Objects.h b/Source/Objects.h index d81cda4..a73d670 100644 --- a/Source/Objects.h +++ b/Source/Objects.h @@ -2,7 +2,7 @@ #define _OBJECTS_H_ #include "Quaternions.h" -#include "gl.h" +#include "gamegl.h" #include "TGALoader.h" #include "Quaternions.h" #include "Frustum.h" diff --git a/Source/OpenGL_Full_Screen.cpp b/Source/OpenGL_Full_Screen.cpp index 694ffd5..223b0c5 100644 --- a/Source/OpenGL_Full_Screen.cpp +++ b/Source/OpenGL_Full_Screen.cpp @@ -76,7 +76,7 @@ extern float oldgamespeed; #include #include "agl.h" - #include "gl.h" + #include "gamegl.h" #include "glu.h" #endif diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index ae73a83..919b1cb 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -59,7 +59,7 @@ extern float volume; #include #include #include -#include "gl.h" +#include "gamegl.h" #include "WinDefs.h" #include #include "fmod.h" diff --git a/Source/Person.h b/Source/Person.h index a7dee6b..5be74b2 100644 --- a/Source/Person.h +++ b/Source/Person.h @@ -3,11 +3,11 @@ /**> HEADER FILES <**/ -#include "gl.h" +#include "gamegl.h" #include "Quaternions.h" #include "fmod.h" -#include "skeleton.h" -#include "models.h" +#include "Skeleton.h" +#include "Models.h" #include "Constants.h" #include "Terrain.h" #include "Sprites.h" diff --git a/Source/Quaternions.h b/Source/Quaternions.h index 872500c..65bd8ae 100644 --- a/Source/Quaternions.h +++ b/Source/Quaternions.h @@ -8,8 +8,8 @@ //#include "Carbon.h" #include "math.h" -#include "Physicsmath.h" -#include "gl.h" +#include "PhysicsMath.h" +#include "gamegl.h" /**> Quaternion Structures <**/ #define PI 3.14159265355555897932384626 @@ -207,9 +207,7 @@ inline void CrossProduct(XYZ P, XYZ Q, XYZ *V){ inline float fast_sqrt (register float arg) { -#ifdef WIN32 - return sqrtf( arg); -#else +#if PLATFORM_MACOSX // Can replace with slower return std::sqrt(arg); register float result; @@ -224,6 +222,8 @@ inline float fast_sqrt (register float arg) result = result + 0.5 * result * (1.0 - arg * result * result); return result * arg; +#else + return sqrtf( arg); #endif } diff --git a/Source/Skeleton.h b/Source/Skeleton.h index 30a9f75..c715fd1 100644 --- a/Source/Skeleton.h +++ b/Source/Skeleton.h @@ -7,10 +7,10 @@ /**> HEADER FILES <**/ -#include "gl.h" +#include "gamegl.h" #include "Quaternions.h" #include "fmod.h" -#include "objects.h" +#include "Objects.h" #include "Sprites.h" #include "binio.h" diff --git a/Source/Skybox.h b/Source/Skybox.h index 2eae596..327dc48 100644 --- a/Source/Skybox.h +++ b/Source/Skybox.h @@ -4,7 +4,7 @@ #include "Quaternions.h" #include "TGALoader.h" #include "Quaternions.h" -#include "gl.h" +#include "gamegl.h" class SkyBox{ public: diff --git a/Source/Sprites.h b/Source/Sprites.h index 191075e..36752ba 100644 --- a/Source/Sprites.h +++ b/Source/Sprites.h @@ -2,7 +2,7 @@ #define _SPRITES_H_ #include "Quaternions.h" -#include "gl.h" +#include "gamegl.h" #include "TGALoader.h" #include "Quaternions.h" #include "Frustum.h" diff --git a/Source/TGALoader.h b/Source/TGALoader.h index 98ea07b..5851c29 100644 --- a/Source/TGALoader.h +++ b/Source/TGALoader.h @@ -15,7 +15,7 @@ #undef Polygon #include #else -#include "gl.h" +#include "gamegl.h" // #include "MoreFilesX.h" #endif diff --git a/Source/Terrain.h b/Source/Terrain.h index 507ff64..a69efbe 100644 --- a/Source/Terrain.h +++ b/Source/Terrain.h @@ -1,7 +1,7 @@ #ifndef _TERRAIN_H_ #define _TERRAIN_H_ -#include "gl.h" +#include "gamegl.h" #include "Frustum.h" #include "Lights.h" #include "TGALoader.h" diff --git a/Source/Text.h b/Source/Text.h index bc314b1..741d1a9 100644 --- a/Source/Text.h +++ b/Source/Text.h @@ -6,7 +6,7 @@ #include "Quaternions.h" //#include "Files.h" #include "Quaternions.h" -#include "gl.h" +#include "gamegl.h" #include "TGALoader.h" class Text{ diff --git a/Source/Weapons.h b/Source/Weapons.h index 36f18de..961364a 100644 --- a/Source/Weapons.h +++ b/Source/Weapons.h @@ -3,11 +3,11 @@ /**> HEADER FILES <**/ -#include "gl.h" +#include "gamegl.h" #include "Quaternions.h" #include "fmod.h" -#include "skeleton.h" -#include "models.h" +#include "Skeleton.h" +#include "Models.h" #include "Constants.h" #include "Terrain.h" #include "Sprites.h" diff --git a/Source/gamegl.h b/Source/gamegl.h new file mode 100644 index 0000000..bc36ba9 --- /dev/null +++ b/Source/gamegl.h @@ -0,0 +1,54 @@ +#ifndef _LUGARU_GL_H_ +#define _LUGARU_GL_H_ + + +#include +#include +#include +#include +#include +#include + +#ifndef WIN32 + #if PLATFORM_LINUX + #include "gl.h" + #include "glu.h" + #include "glext.h" + #else + #include + #include + #include + #endif +#else + #define WIN32_LEAN_AND_MEAN + #define Polygon WinPolygon + #include + #undef Polygon + #define GL_GLEXT_PROTOTYPES + #include + #include + #include + #include + #include "WinDefs.h" + #include "il/ilut.h" + + #define glDeleteTextures( a, b) glDeleteTextures( (a), (const unsigned int *)(b) ); +#endif + +#if !PLATFORM_MACOSX +struct RGBColor +{ + unsigned short red; + unsigned short green; + unsigned short blue; +}; +typedef struct RGBColor RGBColor; +typedef RGBColor * RGBColorPtr; +#endif + +using namespace std; + +#include "logger/logger.h" + +#endif + diff --git a/Source/gl.h b/Source/gl.h deleted file mode 100644 index 3d0a5f2..0000000 --- a/Source/gl.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _LUGARU_GL_H_ -#define _LUGARU_GL_H_ - - -#include -#include -#include -#include -#include -#include - -#ifndef WIN32 - -#include -#include -#include - -#else - -#define WIN32_LEAN_AND_MEAN -#define Polygon WinPolygon -#include -#undef Polygon -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include "WinDefs.h" -#include "il/ilut.h" - -#define glDeleteTextures( a, b) glDeleteTextures( (a), (const unsigned int *)(b) ); - -struct RGBColor -{ - unsigned short red; - unsigned short green; - unsigned short blue; -}; -typedef struct RGBColor RGBColor; -typedef RGBColor * RGBColorPtr; - -#endif - -using namespace std; - -#include "logger/logger.h" - -#endif \ No newline at end of file