]> git.jsancho.org Git - lugaru.git/commitdiff
Removed non-SDL codepaths.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 14 May 2010 05:05:09 +0000 (01:05 -0400)
committerRyan C. Gordon <icculus@icculus.org>
Fri, 14 May 2010 05:05:09 +0000 (01:05 -0400)
Source/Game.h
Source/GameDraw.cpp
Source/GameTick.cpp
Source/Globals.cpp
Source/OpenGL_Windows.cpp

index 727b9985d3eab9d660734468e77f54e72de13707..426eb630a76422ad956c54b6aeca34b1581d740d 100644 (file)
@@ -22,9 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #ifndef _GAME_H_
 #define _GAME_H_
 
-#if USE_SDL
 #include "SDL.h"
-#endif
 
 #if (defined(__APPLE__) && defined(__MACH__))
 #  ifdef PLATFORM_MACOSX
@@ -307,17 +305,9 @@ public:
 
 static __forceinline void swap_gl_buffers(void)
 {
-#ifdef WIN32
-    extern HDC hDC;
-    SwapBuffers( hDC);
-#elif USE_SDL
+
     SDL_GL_SwapBuffers();
-#elif PLATFORM_MACOSX
-    extern AGLContext gaglContext;
-    aglSwapBuffers(gaglContext);
-#else
-    #error define your platform.
-#endif
+
 }
 
 #ifdef __GNUC__
index ec4ec3f6e7d96eef6eed0d4d153e60c962c4141b..5acb9472fbe72f6ef50b40a58975fe7c5c1ed98c 100644 (file)
@@ -2240,10 +2240,10 @@ int Game::DrawGLScene(void)
        }
 
        if(mainmenu){
-#if USE_SDL
+
         // !!! FIXME: hack: clamp framerate in menu so text input works correctly on fast systems.
         SDL_Delay(15);
-#endif
+
                glDrawBuffer(GL_BACK);
                glReadBuffer(GL_BACK);
                glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
@@ -3966,15 +3966,9 @@ int Game::DrawGLScene(void)
 
        //glFlush();
        if(drawmode!=motionblurmode||mainmenu){
-        #if !USE_SDL
-        // this prevents menus from rendering if you hit ESC during
-        //  motion blur sequences...maybe SDL is buffering differently?
-               if(drawmode!=motionblurmode)
-                       swap_gl_buffers();
-        #else
+
                swap_gl_buffers();
-        #endif
-       }
+  }
 
        //myassert(glGetError() == GL_NO_ERROR);
        glDrawBuffer(GL_BACK);
index 2534d7c17de0c1b7d2d293bcc13710ef6c2ee783..6b0e38ce083230c5acdbce044097b82ed4de6e5a 100644 (file)
@@ -1871,10 +1871,6 @@ void     Game::Tick()
 
                                if(newdetail>2)newdetail=detail;
                                if(newdetail<0)newdetail=detail;
-#if !USE_SDL  // we'll take anything that works.
-                               if(newscreenwidth>3000)newscreenwidth=screenwidth;
-                               if(newscreenheight>3000)newscreenheight=screenheight;
-#endif
                                if(newscreenwidth<0)newscreenwidth=screenwidth;
                                if(newscreenheight<0)newscreenheight=screenheight;
 
@@ -2135,7 +2131,7 @@ void      Game::Tick()
                                OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
                        }
                        if(Button()&&!oldbutton&&selected==0){
-                               #if USE_SDL
+                       
                                extern SDL_Rect **resolutions;
                                bool isCustomResolution = true;
                                bool found = false;
@@ -2180,56 +2176,7 @@ void     Game::Tick()
                                        newscreenheight = (int) resolutions[0]->h;
                                }
 
-                               #else
-                               int whichres;
-                               whichres=-1;
-                               if(newscreenwidth==640&&newscreenheight==480)whichres=0;
-                               if(newscreenwidth==800&&newscreenheight==600)whichres=1;
-                               if(newscreenwidth==1024&&newscreenheight==768)whichres=2;
-                               if(newscreenwidth==1280&&newscreenheight==1024)whichres=3;
-                               if(newscreenwidth==1600&&newscreenheight==1200)whichres=4;
-                               if(newscreenwidth==840&&newscreenheight==524)whichres=5;
-                               if(newscreenwidth==1024&&newscreenheight==640)whichres=6;
-                               if(newscreenwidth==1344&&newscreenheight==840)whichres=7;
-                               if(newscreenwidth==1920&&newscreenheight==1200)whichres=8;
-
-                               if(whichres==-1||whichres==8){
-                                       newscreenwidth=640;
-                                       newscreenheight=480;
-                               }
-                               if(whichres==0){
-                                       newscreenwidth=800;
-                                       newscreenheight=600;
-                               }
-                               if(whichres==1){
-                                       newscreenwidth=1024;
-                                       newscreenheight=768;
-                               }
-                               if(whichres==2){
-                                       newscreenwidth=1280;
-                                       newscreenheight=1024;
-                               }
-                               if(whichres==3){
-                                       newscreenwidth=1600;
-                                       newscreenheight=1200;
-                               }
-                               if(whichres==4){
-                                       newscreenwidth=840;
-                                       newscreenheight=524;
-                               }
-                               if(whichres==5){
-                                       newscreenwidth=1024;
-                                       newscreenheight=640;
-                               }
-                               if(whichres==6){
-                                       newscreenwidth=1344;
-                                       newscreenheight=840;
-                               }
-                               if(whichres==7){
-                                       newscreenwidth=1920;
-                                       newscreenheight=1200;
-                               }
-                               #endif
+                               
                        }
                        if(Button()&&!oldbutton&&selected==1){
                                newdetail++;
@@ -2320,10 +2267,6 @@ void     Game::Tick()
 
                                if(newdetail>2)newdetail=detail;
                                if(newdetail<0)newdetail=detail;
-#if !USE_SDL  // we'll take anything that works.
-                               if(newscreenwidth>3000)newscreenwidth=screenwidth;
-                               if(newscreenheight>3000)newscreenheight=screenheight;
-#endif
                                if(newscreenwidth<0)newscreenwidth=screenwidth;
                                if(newscreenheight<0)newscreenheight=screenheight;
 
@@ -3068,10 +3011,6 @@ void     Game::Tick()
                        if(mainmenu==3){
                                if(newdetail>2)newdetail=detail;
                                if(newdetail<0)newdetail=detail;
-#if !USE_SDL  // we'll take anything that works.
-                               if(newscreenwidth>3000)newscreenwidth=screenwidth;
-                               if(newscreenheight>3000)newscreenheight=screenheight;
-#endif
                                if(newscreenwidth<0)newscreenwidth=screenwidth;
                                if(newscreenheight<0)newscreenheight=screenheight;
 
@@ -5714,10 +5653,6 @@ void     Game::Tick()
                        if(mainmenu==3){
                                if(newdetail>2)newdetail=detail;
                                if(newdetail<0)newdetail=detail;
-#if !USE_SDL  // we'll take anything that works.
-                               if(newscreenwidth>3000)newscreenwidth=screenwidth;
-                               if(newscreenheight>3000)newscreenheight=screenheight;
-#endif
                                if(newscreenwidth<0)newscreenwidth=screenwidth;
                                if(newscreenheight<0)newscreenheight=screenheight;
 
index be2a006d633eddc0f4f4d18a061bbe90d8125596..8d9682dc3ef75725e396366f8a9408a5d729f36f 100644 (file)
@@ -19,9 +19,7 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
-#if USE_SDL
 #include "SDL.h"
-#endif
 
 #include "gamegl.h"
 #include "Quaternions.h"
@@ -79,15 +77,9 @@ int numsounds = 0;
 Terrain terrain;
 Sprites sprites;
 float sps = 0;
-#ifdef WIN32
-HDC hDC;
-#elif USE_SDL
+
 SDL_Surface *sdlscreen;
-#elif PLATFORM_MACOSX
-AGLContext gaglContext;
-#else
-#error Define your platform.
-#endif
+
 int kTextureSize = 0;
 int detail = 0;
 FRUSTUM frustum;
index c1eae17bf7b101a5e3e084e3ad54af8c167ec17b..1c362a8bbc59e59a6193985c8b771bd70aab6431 100644 (file)
@@ -119,7 +119,7 @@ extern float volume;
 using namespace std;
 
 
-#if USE_SDL
+
 SDL_Rect **resolutions = NULL;
 static SDL_Rect rect_1024_768 = { 0, 0, 1024, 768 };
 static SDL_Rect rect_800_600  = { 0, 0, 800,  600 };
@@ -130,7 +130,7 @@ static SDL_Rect *hardcoded_resolutions[] = {
     &rect_640_480,
     NULL
 };
-#endif
+
 
 
 unsigned int resolutionDepths[8][2] = {0};
@@ -163,7 +163,7 @@ typedef struct tagPOINT {
 } POINT, *PPOINT; 
 #endif
 
-#if USE_SDL
+
 
 #ifdef _MSC_VER
 #pragma warning(push)
@@ -225,7 +225,7 @@ void sdlGetCursorPos(POINT *pt)
 #undef MessageBox
 #endif
 #define MessageBox(hwnd,text,title,flags) STUBBED("msgbox")
-#endif
+
 
 Point delta;
 
@@ -339,9 +339,7 @@ Boolean Button()
     return g_button;
 }
 
-#if !USE_SDL
-static void initSDLKeyTable(void) {}
-#else
+
 #define MAX_SDLKEYS SDLK_LAST
 static unsigned short KeyTable[MAX_SDLKEYS];
 
@@ -555,7 +553,7 @@ static void sdlEventProc(const SDL_Event &e, Game &game)
             return;
     }
 }
-#endif
+
 
 // --------------------------------------------------------------------------
 
@@ -845,10 +843,7 @@ Boolean SetUp (Game & game)
                if(detail<0)detail=0;
                if(screenwidth<0)screenwidth=640;
                if(screenheight<0)screenheight=480;
-#if !USE_SDL  // we'll take anything that works.
-               if(screenwidth>3000)screenwidth=640;
-               if(screenheight>3000)screenheight=480;
-#endif
+
        }
        if(kBitsPerPixel!=32&&kBitsPerPixel!=16){
                kBitsPerPixel=16;
@@ -859,7 +854,7 @@ Boolean SetUp (Game & game)
 
        SetupDSpFullScreen();
 
-#if USE_SDL
+
     if (!SDL_WasInit(SDL_INIT_VIDEO))
     {
         if (SDL_Init(SDL_INIT_VIDEO) == -1)
@@ -957,7 +952,7 @@ Boolean SetUp (Game & game)
 
     if (!cmdline("nomousegrab"))
         SDL_WM_GrabInput(SDL_GRAB_ON);
-#endif
+
 
        glClear( GL_COLOR_BUFFER_BIT );
        swap_gl_buffers();
@@ -1020,7 +1015,7 @@ Boolean SetUp (Game & game)
 
 static void DoMouse(Game & game)
 {
-#if USE_SDL
+
        if(mainmenu||(abs(game.deltah)<10*realmultiplier*1000&&abs(game.deltav)<10*realmultiplier*1000))
        {
                game.deltah *= usermousesensitivity;
@@ -1036,7 +1031,7 @@ static void DoMouse(Game & game)
         else if (game.mousecoordv >= kContextHeight)
             game.mousecoordv = kContextHeight - 1;
        }
-#endif
+
 }
 
 
@@ -1174,7 +1169,7 @@ void CleanUp (void)
 
 
 
-#if USE_SDL
+
     SDL_Quit();
     #define GL_FUNC(ret,fn,params,call,rt) p##fn = NULL;
     #include "glstubs.h"
@@ -1182,7 +1177,7 @@ void CleanUp (void)
     // cheat here...static destructors are calling glDeleteTexture() after
     //  the context is destroyed and libGL unloaded by SDL_Quit().
     pglDeleteTextures = glDeleteTextures_doNothing;
-#endif
+
 }
 
 // --------------------------------------------------------------------------
@@ -1359,7 +1354,7 @@ int main(int argc, char **argv)
                                        gameFocused = true;
 
                                        // check windows messages
-                                       #if USE_SDL
+                       
                                        game.deltah = 0;
                                        game.deltav = 0;
                                        SDL_Event e;
@@ -1373,7 +1368,7 @@ int main(int argc, char **argv)
                                                }
                                                sdlEventProc(e, game);
                                        }
-                                       #endif
+                               
 
                                        // game
                                        DoUpdate(game);
@@ -1435,41 +1430,7 @@ int main(int argc, char **argv)
 
        // --------------------------------------------------------------------------
 
-#if !USE_SDL
-       int resolutionID(int width, int height)
-       {
-               int whichres;
-               whichres=-1;
-               if(width==640 && height==480)whichres=0;
-               if(width==800 && height==600)whichres=1;
-               if(width==1024 && height==768)whichres=2;
-               if(width==1280 && height==1024)whichres=3;
-               if(width==1600 && height==1200)whichres=4;
-               if(width==840 && height==524)whichres=5;
-               if(width==1024 && height==640)whichres=6;
-               if(width==1344 && height==840)whichres=7;
-               if(width==1920 && height==1200)whichres=8;
-
-               return whichres;
-       }
 
-       int closestResolution(int width, int height)
-       {
-               int whichres;
-               whichres=-1;
-               if(width>=640 && height>=480)whichres=0;
-               if(width>=800 && height>=600)whichres=1;
-               if(width>=1024 && height>=768)whichres=2;
-               if(width>=1280 && height>=1024)whichres=3;
-               if(width>=1600 && height>=1200)whichres=4;
-               if(width==840 && height==524)whichres=5;
-               if(width==1024 && height==640)whichres=6;
-               if(width==1344 && height==840)whichres=7;
-               if(width>=1920 && height>=1200)whichres=8;
-
-               return whichres;
-       }
-#endif
 
        bool selectDetail(int & width, int & height, int & bpp, int & detail)
        {
@@ -1477,75 +1438,7 @@ int main(int argc, char **argv)
 
                // currently with SDL, we just use whatever is requested
                //  and don't care.  --ryan.
-               #if !USE_SDL
-               int whichres = closestResolution(width, height);
-
-               while (true)
-               {
-                       if(whichres<=0 || whichres>8){
-                               whichres = 0;
-                               width=640;
-                               height=480;
-                       }
-                       if(whichres==1){
-                               width=800;
-                               height=600;
-                       }
-                       if(whichres==2){
-                               width=1024;
-                               height=768;
-                       }
-                       if(whichres==3){
-                               width=1280;
-                               height=1024;
-                       }
-                       if(whichres==4){
-                               width=1600;
-                               height=1200;
-                       }
-                       if(whichres==5){
-                               width=840;
-                               height=524;
-                       }
-                       if(whichres==6){
-                               width=1024;
-                               height=640;
-                       }
-                       if(whichres==7){
-                               width=1344;
-                               height=840;
-                       }
-                       if(whichres==8){
-                               width=1920;
-                               height=1200;
-                       }
-
-                       if ((detail != 0) && (resolutionDepths[whichres][1] != 0))
-                       {
-                               break;
-                       }
-                       else if ((detail == 0) && (resolutionDepths[whichres][0] != 0))
-                       {
-                               break;
-                       }
-                       else if ((detail != 0) && (resolutionDepths[whichres][0] != 0))
-                       {
-                               res = false;
-                               detail = 0;
-                               break;
-                       }
-                       else
-
-            if (0 == whichres)
-                       {
-                               break;
-                       }
-
-                       --whichres;
-               }
-
-               bpp = resolutionDepths[whichres][(detail != 0)];
-               #endif
+               
 
                return res;
        }