shithub: duke3d

Download patch

ref: f4f62dc315d57fb6204c6967ffd56a4fab65761d
parent: d05dd072f746aeffb81e18dff76d07a29f8643b8
author: unknown <fabien@fabien-PC.(none)>
date: Sat Dec 15 16:17:20 EST 2012

Removed the incomplete OpenGL implementation.

--- a/Engine/src/sdl_driver.c
+++ b/Engine/src/sdl_driver.c
@@ -36,26 +36,6 @@
 
 #include "icon.h"
 
-/**/
-/*
-void (*callcommit)(void);
-void (*initcrc)(void);
-int32_t (*getcrc)(uint8_t  *buffer, short bufleng);
-void (*initmultiplayers)(uint8_t  damultioption, uint8_t  dacomrateoption, uint8_t  dapriority);
-void (*sendpacket)(int32_t other, uint8_t  *bufptr, int32_t messleng);
-void (*setpackettimeout)(int32_t datimeoutcount, int32_t daresendagaincount);
-void (*uninitmultiplayers)(void);
-void (*sendlogon)(void);
-void (*sendlogoff)(void);
-int  (*getoutputcirclesize)(void);
-void (*setsocket)(short newsocket);
-short (*getpacket)(short *other, uint8_t  *bufptr);
-void (*flushpackets)(void);
-void (*genericmultifunction)(int32_t other, uint8_t  *bufptr, int32_t messleng, int32_t command);
-*/
-/**/
-
-
 // NATIVE TIMER FUNCTION DECLARATION
 /*
  FCS: The timer section sadly uses Native high precision calls to implement timer functions.
@@ -281,10 +261,6 @@
 #endif
 }
 
-#if (defined USE_OPENGL)
-#include "buildgl.h"
-#endif
-
 #if ((defined PLATFORM_WIN32))
 #include <windows.h>
 #endif
@@ -377,22 +353,6 @@
     } /* if */
 } /* sdldebug */
 
-
-#if (defined USE_OPENGL)
-void sgldebug(const uint8_t  *fmt, ...)
-{
-    va_list ap;
-
-    if (_sdl_debug_file)
-    {
-        va_start(ap, fmt);
-        __out_sdldebug("BUILDSDL/GL", fmt, ap);
-        va_end(ap);
-    } /* if */
-} /* sgldebug */
-#endif
-
-
 static void __append_sdl_surface_flag(SDL_Surface *_surface, char  *str,
                                       size_t strsize, Uint32 flag,
                                       const char  *flagstr)
@@ -1069,9 +1029,6 @@
 {
     const char  *envr = getenv(BUILD_RENDERER);
 
-#ifdef USE_OPENGL
-    int need_opengl_lib = 0;
-#endif
 
     if ((envr == NULL) || (strcmp(envr, ENVRSTR_RENDERER_SOFTWARE) == 0))
         renderer = RENDERER_SOFTWARE;
@@ -1093,23 +1050,6 @@
 							"BUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError());
     } /* if */
 
-#ifdef USE_OPENGL
-    if (need_opengl_lib)
-    {
-        if (opengl_load_library() == -1)
-        {
-            SDL_Quit();
-            fprintf(stderr, "BUILDSDL/GL: Failed to load OpenGL library!\n");
-            if (getenv(BUILD_SDLDEBUG) == NULL)
-            {
-                fprintf(stderr, "BUILDSDL/GL: Try setting environment variable"
-                                " %s for more info.\n", BUILD_SDLDEBUG);
-            } /* if */
-            _exit(42);
-        } /* if */
-    } /* if */
-#endif
-
 } /* set_sdl_renderer */
 
 
@@ -1402,13 +1342,6 @@
 	SDL_Surface     *image;
 	Uint32          colorkey;
 
-#ifdef USE_OPENGL
-    static int shown_gl_strings = 0;
-    int gl = using_opengl();
-    if (gl)
-        sdl_flags |= SDL_OPENGL;
-#endif
-
 	// Install icon
 	image = SDL_LoadBMP_RW(SDL_RWFromMem(iconBMP, sizeof(iconBMP)), 1);
 	// image = SDL_LoadBMP("nuclear2.bmp");
@@ -1442,33 +1375,6 @@
 
     go_to_new_vid_mode((int) davidoption, daxdim, daydim);
 
-    #ifdef USE_OPENGL
-        if (gl)
-        {
-            if (!shown_gl_strings)
-            {
-                sgldebug("GL_VENDOR [%s]", (uint8_t  *) dglGetString(GL_VENDOR));
-                sgldebug("GL_RENDERER [%s]", (uint8_t  *) dglGetString(GL_RENDERER));
-                sgldebug("GL_VERSION [%s]", (uint8_t  *) dglGetString(GL_VERSION));
-                sgldebug("GL_EXTENSIONS [%s]", (uint8_t  *) dglGetString(GL_EXTENSIONS));
-                shown_gl_strings = 1;
-            } /* if */
-
-            dglViewport(0, 0, daxdim, daydim);
-            dglEnable(GL_TEXTURE_2D);
-            dglPixelTransferi(GL_MAP_COLOR, GL_TRUE);
-            dglPixelTransferi(GL_INDEX_SHIFT, 0);
-            dglPixelTransferi(GL_INDEX_OFFSET, 0);
-            dglClearDepth(1.0);
-            dglDepthFunc(GL_LESS);
-            dglEnable(GL_DEPTH_TEST);
-            dglShadeModel(GL_SMOOTH);
-            dglMatrixMode(GL_PROJECTION);
-            dglLoadIdentity();
-            dglMatrixMode(GL_MODELVIEW);
-        } /* if */
-    #endif
-
     qsetmode = 200;
     last_render_ticks = getticks();
 
@@ -1763,23 +1669,6 @@
     SDL_Color *sdlp = &fmt_swap[start];
     uint8_t  *p = palettebuffer;
     int i;
-
-#if (defined USE_OPENGL)
-    int gl = using_opengl();
-    GLfloat gl_reds[256];
-    GLfloat gl_greens[256];
-    GLfloat gl_blues[256];
-    GLfloat gl_alphas[256];
-
-    if (gl)
-    {
-        dglGetPixelMapfv(GL_PIXEL_MAP_I_TO_R, gl_reds);
-        dglGetPixelMapfv(GL_PIXEL_MAP_I_TO_G, gl_greens);
-        dglGetPixelMapfv(GL_PIXEL_MAP_I_TO_B, gl_blues);
-        dglGetPixelMapfv(GL_PIXEL_MAP_I_TO_A, gl_alphas);
-    } /* if */
-#endif
-
     assert( (start + num) <= (sizeof (fmt_swap) / sizeof (SDL_Color)) );
 
     for (i = 0; i < num; i++)
@@ -1788,29 +1677,9 @@
         sdlp->g = (Uint8) ((((float) *p++) / 63.0) * 255.0);
         sdlp->r = (Uint8) ((((float) *p++) / 63.0) * 255.0);
         sdlp->unused = *p++;   /* This byte is unused in BUILD, too. */
-
-#if (defined USE_OPENGL)
-        if (gl)
-        {
-            gl_reds[i+start]   = ((GLfloat) sdlp->r) / 255.0f;
-            gl_greens[i+start] = ((GLfloat) sdlp->g) / 255.0f;
-            gl_blues[i+start]  = ((GLfloat) sdlp->b) / 255.0f;
-            gl_alphas[i+start] = 1.0f;
-        } /* if */
-#endif
-
         sdlp++;
     } /* for */
 
-#if (defined USE_OPENGL)
-    if (gl)
-    {
-        dglPixelMapfv(GL_PIXEL_MAP_I_TO_R, start + num, gl_reds);
-        dglPixelMapfv(GL_PIXEL_MAP_I_TO_G, start + num, gl_greens);
-        dglPixelMapfv(GL_PIXEL_MAP_I_TO_B, start + num, gl_blues);
-        dglPixelMapfv(GL_PIXEL_MAP_I_TO_A, start + num, gl_alphas);
-    } /* if */
-#endif
     return(SDL_SetColors(surface, fmt_swap, start, num));
 } /* VBE_setPalette */
 
@@ -1917,12 +1786,6 @@
 		SDL_UpdateRect(surface, 0, 0, 0, 0);
     }
 
-#ifdef USE_OPENGL
-    else if (renderer == RENDERER_OPENGL3D)
-    {
-        opengl_swapbuffers();
-    } /* else if */
-#endif
 
     if ((debug_hall_of_mirrors) && (qsetmode == 200) && (frameplace))
     {
@@ -2012,15 +1875,7 @@
     Uint8 *wanted_end;
     Uint8 *pixels;
 
-#if (defined USE_OPENGL)
-    if (renderer == RENDERER_OPENGL3D)
-    {
-        /* !!! dglClearColor() ... */
-        return;
-    } /* if */
-#endif
-
-    if (SDL_MUSTLOCK(surface))
+	if (SDL_MUSTLOCK(surface))
         SDL_LockSurface(surface);
 
     pixels = get_framebuffer();
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -6133,10 +6133,6 @@
     if( (ps[myconnectindex].gm&MODE_TYPE) || (ps[myconnectindex].gm&MODE_MENU))
         return;
 
-#ifdef BETA
-    return;
-#endif
-
     if ( ps[myconnectindex].cheat_phase == 1)
     {
        while (KB_KeyWaiting())
@@ -7505,37 +7501,38 @@
 		//MIDI start here
 		playmusic(&env_music_fn[0][0]);
 		
+		//"REALITY IS OUR GAME" Screen
 	    for(i=0;i<64;i+=7) 
 			palto(0,0,0,i);
-
 	    ps[myconnectindex].palette = drealms;
-
 	    palto(0,0,0,63);
 	    rotatesprite(0,0,65536L,0,DREALMS,0,0,2+8+16+64, 0,0,xdim-1,ydim-1);
 	    nextpage(); 
 		for(i=63;i>0;i-=7) 
 			palto(0,0,0,i);
-
-
 	    totalclock = 0;
 	    while( totalclock < (120*7) && !KB_KeyWaiting() )
 	        getpackets();
 	
+
+
+
+
 	    for(i=0;i<64;i+=7) 
 			palto(0,0,0,i);
 	    clearview(0L);
 	    nextpage();
-
-	
 	    ps[myconnectindex].palette = titlepal;
 	    flushperms();
 	    rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1);
 	    KB_FlushKeyboardQueue();
 	    nextpage();
-	    for(i=63;i>0;i-=7) palto(0,0,0,i);
+	    for(i=63;i>0;i-=7) 
+			palto(0,0,0,i);
+
 	    totalclock = 0;
 	
-
+		//Animate screen (Duke picture wiht "DUKE" "NUKEM 3D" coming from far away and hitting the screen"
 	    while(totalclock < (860+120) && !KB_KeyWaiting())
 	    {
 	        rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1);
@@ -7636,10 +7633,16 @@
     int32_t fil, l;
 
     fil = kopen4load("d3dtimbr.tmb",0);
-    if(fil == -1) return;
+
+    if(fil == -1) 
+		return;
+
     l = kfilelength(fil);
+
     kread(fil,(uint8_t  *)tmb,l);
+
     MUSIC_RegisterTimbreBank(tmb);
+
     kclose(fil);
 }
 
@@ -8459,6 +8462,8 @@
 			Logo(); //play logo, (game must be started via menus).
 		}
 	}
+
+
  
 	else if(ud.warp_on == 1) //if cmd arguments /V and /L are given.
     {
@@ -8521,9 +8526,10 @@
 
     ud.warp_on = 0;
 
-    while ( !(ps[myconnectindex].gm&MODE_END) ) //The whole loop!!!!!!!!!!!!!!!!!!
+	//The main game loop is here.
+    while ( !(ps[myconnectindex].gm&MODE_END) )
     {
-    		sampletimer();
+    	sampletimer();
         if( ud.recstat == 2 || ud.multimode > 1 || ( ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU ) )
             if( ps[myconnectindex].gm&MODE_GAME )
 			{
@@ -8581,9 +8587,8 @@
         cheats();
 
         if( !CONSOLE_IsActive() )
-        {
           nonsharedkeys();
-        }
+        
 
         if( (ud.show_help == 0 && ud.multimode < 2 && !(ps[myconnectindex].gm&MODE_MENU) ) || ud.multimode > 1 || ud.recstat == 2)
             i = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536);
@@ -8593,16 +8598,11 @@
         displayrooms(screenpeek,i);
         displayrest(i);
 
-//        if( KB_KeyPressed(sc_F) )
-//        {
-//            KB_ClearKeyDown(sc_F);
-//            addplayer();
-//        }
-
         if(ps[myconnectindex].gm&MODE_DEMO)
             goto MAIN_LOOP_RESTART;
 
-        if(debug_on) caches();
+        if(debug_on) 
+			caches();
 
         checksync();