]> git.jsancho.org Git - lugaru.git/commitdiff
More work.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 5 Aug 2005 13:49:28 +0000 (13:49 +0000)
committerRyan C. Gordon <icculus@icculus.org>
Fri, 5 Aug 2005 13:49:28 +0000 (13:49 +0000)
20 files changed:
Source/Frustum.cpp
Source/Game.h
Source/GameDraw.cpp
Source/Globals.cpp
Source/Lights.h
Source/Models.h
Source/Objects.h
Source/OpenGL_Full_Screen.cpp
Source/OpenGL_Windows.cpp
Source/Person.h
Source/Quaternions.h
Source/Skeleton.h
Source/Skybox.h
Source/Sprites.h
Source/TGALoader.h
Source/Terrain.h
Source/Text.h
Source/Weapons.h
Source/gamegl.h [new file with mode: 0644]
Source/gl.h [deleted file]

index 9ddaa10c59732951270169820e8789d2b543f9db..f3ab44ed9f1c91a960389e66aaf3456b203fd302 100644 (file)
@@ -1,7 +1,7 @@
 #include "Frustum.h"
 #include <math.h>
 
-#include "gl.h"
+#include "gamegl.h"
 
 
 void FRUSTUM::
index 65cbaf1b00e5d33cd84d4a930a77dd024307f15c..6a7644cab4a57327377436ea30874c863b5b7b87 100644 (file)
@@ -2,15 +2,21 @@
 #define _GAME_H_
 
 #ifndef WIN32
+#ifdef PLATFORM_MACOSX
 #include <Carbon.h>
 #include "Quicktime.h"
 #endif
+#endif
+
 //Jordan included glut.h
 //#include <glut.h>
 
 #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 <fstream>
-#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();
        }
index e3cd41b028fcc9783ed9f9618a260fad5bcd3e38..5ea481a29d4cb09722da3bf52826873569769162 100644 (file)
@@ -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(num<LONGLONGCONST(5000000000000000)){
                num*=1.85421521;
        }
 
-       while(num>9900000000000000){
+       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
                }
index 0a4c6d26a3f9149d042d61bd8a37c93c7a6e2469..f5598e766cf8356718d0a32499b0e7873a4ea733 100644 (file)
@@ -1,4 +1,4 @@
-#include "gl.h"
+#include "gamegl.h"
 #include "Quaternions.h"
 #include "Lights.h"
 #include "Skeleton.h"
index 32d9f56a0958a6c83154c599192c99e82a576a9a..ef98337f40bcf354384a1bdc6a003f23f030c162 100644 (file)
@@ -3,7 +3,7 @@
 
 
 /**> HEADER FILES <**/
-#include "gl.h"
+#include "gamegl.h"
 #include "Quaternions.h"
 
 class Light{
index 2f1da97fa140da17d3c8defcc5dcdaf1929de21d..6154d6f3b0a7b0cd0fd3fd0777ce251bc092e813 100644 (file)
@@ -5,7 +5,7 @@
 //
 // Model Maximums
 //
-#include "gl.h"
+#include "gamegl.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
index d81cda4dacaadfa6695fbf0fe823422374b5fc00..a73d670f74244ce2c5337534479a5893f0feb2cb 100644 (file)
@@ -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"
index 694ffd5f16872fde9772a70f05d739ff0bfd4330..223b0c57074e4d96807acca6ba48127326cc4916 100644 (file)
@@ -76,7 +76,7 @@ extern float oldgamespeed;
     #include <Profiler.h>
 
        #include "agl.h"
-    #include "gl.h"
+    #include "gamegl.h"
        #include "glu.h"
 #endif
 
index ae73a83775506edc94ecc3af918a75b8543b60ae..919b1cb612c46cbf5bec42eeeb9a8b119fa8eda6 100644 (file)
@@ -59,7 +59,7 @@ extern float volume;
 #include <string.h>
 #include <fstream>
 #include <iostream>
-#include "gl.h"
+#include "gamegl.h"
 #include "WinDefs.h"
 #include <shellapi.h>
 #include "fmod.h"
index a7dee6b789fc76913866aa6afa94f26566d11ad5..5be74b22b3bcc24b89c92335891bc0890e6f3229 100644 (file)
@@ -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"
index 872500c9ddd8371d4f413515fc7a1eb685c7f2f9..65bd8ae1d16fc16553224094620c7289ff3648be 100644 (file)
@@ -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
 }
 
index 30a9f75202cb967b39a2c4e622a1c496f9b272cb..c715fd14d0699917c868fc0cdc4ac7121a23464d 100644 (file)
@@ -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"
 
index 2eae596a9a7a1f22b29c8cebd9f2d38e590592b4..327dc4869c8930d1257a3e4e66b5b60b7bc79436 100644 (file)
@@ -4,7 +4,7 @@
 #include "Quaternions.h"
 #include "TGALoader.h"
 #include "Quaternions.h"
-#include "gl.h"                
+#include "gamegl.h"
 
 class SkyBox{
 public:
index 191075e58e45e7c0a461f33556604438c382bf23..36752ba5c99c552d5cd302351baada221303dfdf 100644 (file)
@@ -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"
index 98ea07b8b3567f59487f6166ed507d4267d27f5d..5851c29f3979148e1881ce865a1bfc18af44602a 100644 (file)
@@ -15,7 +15,7 @@
 #undef Polygon
 #include <gl/gl.h>
 #else
-#include "gl.h"
+#include "gamegl.h"
 //     #include "MoreFilesX.h"
 #endif
 
index 507ff640701bd0a4ca598ebbdc4242d27383df88..a69efbe43e14c7dd55e1abd9e3483c4f199d3540 100644 (file)
@@ -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"
index bc314b1b77f71916422798f6247026fbff1fdf08..741d1a9b4306bd430384ea756b9a80390a43b039 100644 (file)
@@ -6,7 +6,7 @@
 #include "Quaternions.h"
 //#include "Files.h"
 #include "Quaternions.h"
-#include "gl.h"
+#include "gamegl.h"
 #include "TGALoader.h"
 
 class Text{
index 36f18dee430c0d2427f4b4ea72f41838eb1a96f6..961364a44c3d72177bf8e9a57368e2ca9683e58d 100644 (file)
@@ -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 (file)
index 0000000..bc36ba9
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef _LUGARU_GL_H_
+#define _LUGARU_GL_H_
+
+
+#include <cstring>
+#include <iostream>
+#include <fstream>
+#include <algorithm>
+#include <map>
+#include <string>
+
+#ifndef WIN32
+  #if PLATFORM_LINUX
+    #include "gl.h"
+    #include "glu.h"
+    #include "glext.h"
+  #else
+    #include <gl.h>
+    #include <glu.h>
+    #include <glext.h>
+  #endif
+#else
+  #define WIN32_LEAN_AND_MEAN
+  #define Polygon WinPolygon
+  #include <windows.h>
+  #undef Polygon
+  #define GL_GLEXT_PROTOTYPES
+  #include <gl/gl.h>
+  #include <gl/glu.h>
+  #include <gl/glaux.h>
+  #include <gl/glext.h>
+  #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 (file)
index 3d0a5f2..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef _LUGARU_GL_H_
-#define _LUGARU_GL_H_
-
-
-#include <cstring>
-#include <iostream>
-#include <fstream>
-#include <algorithm>
-#include <map>
-#include <string>
-
-#ifndef WIN32
-
-#include <gl.h>
-#include <glu.h>
-#include <glext.h>
-
-#else
-
-#define WIN32_LEAN_AND_MEAN
-#define Polygon WinPolygon
-#include <windows.h>
-#undef Polygon
-#define GL_GLEXT_PROTOTYPES
-#include <gl/gl.h>
-#include <gl/glu.h>
-#include <gl/glaux.h>
-#include <gl/glext.h>
-#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