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;
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;
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++;
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;
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;
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;
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 };
&rect_640_480,
NULL
};
-#endif
+
unsigned int resolutionDepths[8][2] = {0};
} POINT, *PPOINT;
#endif
-#if USE_SDL
+
#ifdef _MSC_VER
#pragma warning(push)
#undef MessageBox
#endif
#define MessageBox(hwnd,text,title,flags) STUBBED("msgbox")
-#endif
+
Point delta;
return g_button;
}
-#if !USE_SDL
-static void initSDLKeyTable(void) {}
-#else
+
#define MAX_SDLKEYS SDLK_LAST
static unsigned short KeyTable[MAX_SDLKEYS];
return;
}
}
-#endif
+
// --------------------------------------------------------------------------
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;
SetupDSpFullScreen();
-#if USE_SDL
+
if (!SDL_WasInit(SDL_INIT_VIDEO))
{
if (SDL_Init(SDL_INIT_VIDEO) == -1)
if (!cmdline("nomousegrab"))
SDL_WM_GrabInput(SDL_GRAB_ON);
-#endif
+
glClear( GL_COLOR_BUFFER_BIT );
swap_gl_buffers();
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;
else if (game.mousecoordv >= kContextHeight)
game.mousecoordv = kContextHeight - 1;
}
-#endif
+
}
-#if USE_SDL
+
SDL_Quit();
#define GL_FUNC(ret,fn,params,call,rt) p##fn = NULL;
#include "glstubs.h"
// cheat here...static destructors are calling glDeleteTexture() after
// the context is destroyed and libGL unloaded by SDL_Quit().
pglDeleteTextures = glDeleteTextures_doNothing;
-#endif
+
}
// --------------------------------------------------------------------------
gameFocused = true;
// check windows messages
- #if USE_SDL
+
game.deltah = 0;
game.deltav = 0;
SDL_Event e;
}
sdlEventProc(e, game);
}
- #endif
+
// game
DoUpdate(game);
// --------------------------------------------------------------------------
-#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)
{
// 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;
}