From cb934b868dcd14d10d1240617fdb5596fe4593ef Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Mon, 6 Nov 2006 14:08:24 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@493 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/main.cpp | 19 +++++++++++++++---- source/src/protos.h | 2 +- source/src/rendergl.cpp | 4 +++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/source/src/main.cpp b/source/src/main.cpp index 6136e740..e4fd4066 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -204,7 +204,8 @@ int framesinmap = 0; int main(int argc, char **argv) { - int fs = SDL_FULLSCREEN, par = 0, uprate = 0, maxcl = 4; + bool dedicated = false; + int fs = SDL_FULLSCREEN, depth = 0, bpp = 0, fsaa = 0, par = 0, uprate = 0, maxcl = 4; char *sdesc = "", *ip = "", *master = NULL, *passwd = "", *maprot = NULL; islittleendian = *((char *)&islittleendian); @@ -216,9 +217,13 @@ int main(int argc, char **argv) char *a = &argv[i][2]; if(argv[i][0]=='-') switch(argv[i][1]) { + case 'd': dedicated = true; break; case 't': fs = 0; break; case 'w': scr_w = atoi(a); break; case 'h': scr_h = atoi(a); break; + case 'z': depth = atoi(a); break; + case 'b': bpp = atoi(a); break; + case 'a': fsaa = atoi(a); break; case 'u': uprate = atoi(a); break; case 'n': sdesc = a; break; case 'i': ip = a; break; @@ -241,7 +246,7 @@ int main(int argc, char **argv) if(enet_initialize()<0) fatal("Unable to initialise network module"); initclient(); - initserver(false, uprate, sdesc, ip, master, passwd, maxcl, NULL, NULL); // never returns if dedicated + initserver(dedicated, uprate, sdesc, ip, master, passwd, maxcl, NULL, NULL); // never returns if dedicated log("world"); empty_world(7, true); @@ -251,13 +256,19 @@ int main(int argc, char **argv) log("video: mode"); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + if(depth) SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depth); + if(fsaa) + { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa); + }; #ifdef WIN32 #ifdef SDL_RESIZABLE #undef SDL_RESIZABLE #endif #define SDL_RESIZABLE 0 #endif - screen = SDL_SetVideoMode(scr_w, scr_h, 0, SDL_OPENGL|SDL_RESIZABLE|fs); + screen = SDL_SetVideoMode(scr_w, scr_h, bpp, SDL_OPENGL|SDL_RESIZABLE|fs); if(screen==NULL) fatal("Unable to create OpenGL screen"); fullscreen = fs!=0; @@ -271,7 +282,7 @@ int main(int argc, char **argv) SDL_ShowCursor(0); log("gl"); - gl_init(scr_w, scr_h); + gl_init(scr_w, scr_h, bpp, depth, fsaa); log("basetex"); int xs, ys; diff --git a/source/src/protos.h b/source/src/protos.h index 686abcb7..d55939db 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -38,7 +38,7 @@ extern bool resolverwait(const char *name, ENetAddress *address); extern void writeservercfg(); // rendergl -extern void gl_init(int w, int h); +extern void gl_init(int w, int h, int bpp, int depth, int fsaa); extern void cleangl(); extern void gl_drawframe(int w, int h, float changelod, float curfps); extern bool installtex(int tnum, char *texname, int &xs, int &ys, bool clamp = false, bool highqual=false); diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 40cc9984..c1b26010 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -17,7 +17,7 @@ void purgetextures(); GLUquadricObj *qsphere = NULL; int glmaxtexsize = 256; -void gl_init(int w, int h) +void gl_init(int w, int h, int bpp, int depth, int fsaa) { //#define fogvalues 0.5f, 0.6f, 0.7f, 1.0f @@ -58,6 +58,8 @@ void gl_init(int w, int h) glNewList(1, GL_COMPILE); gluSphere(qsphere, 1, 12, 6); glEndList(); + + if(fsaa) glEnable(GL_MULTISAMPLE); }; void cleangl()