]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
another attempt to fix skybox loading
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 15 Jun 2001 20:55:45 +0000 (20:55 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 15 Jun 2001 20:55:45 +0000 (20:55 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@234 d7cf8633-e32d-0410-b094-e92efae38249

gl_poly.c
gl_poly.h
render.h

index df53f9f05bb395e1760c7587209c3b6e5e8c527b..1bc09e667dad2721548c366f28666c64f72715c7 100644 (file)
--- a/gl_poly.c
+++ b/gl_poly.c
@@ -751,7 +751,7 @@ void skypolyrender(void)
        }
 }
 
        }
 }
 
-char skyname[256];
+static char skyname[256];
 
 /*
 ==================
 
 /*
 ==================
@@ -760,19 +760,19 @@ R_SetSkyBox
 */
 char   *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
 rtexture_t *skyboxside[6];
 */
 char   *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
 rtexture_t *skyboxside[6];
-void R_SetSkyBox(char *sky)
+int R_SetSkyBox(char *sky)
 {
        int             i;
        char    name[1024];
        byte*   image_rgba;
 
        if (strcmp(sky, skyname) == 0) // no change
 {
        int             i;
        char    name[1024];
        byte*   image_rgba;
 
        if (strcmp(sky, skyname) == 0) // no change
-               return;
+               return true;
 
        if (strlen(sky) > 1000)
        {
                Con_Printf ("sky name too long (%i, max is 1000)\n", strlen(sky));
 
        if (strlen(sky) > 1000)
        {
                Con_Printf ("sky name too long (%i, max is 1000)\n", strlen(sky));
-               return;
+               return false;
        }
 
        skyboxside[0] = skyboxside[1] = skyboxside[2] = skyboxside[3] = skyboxside[4] = skyboxside[5] = NULL;
        }
 
        skyboxside[0] = skyboxside[1] = skyboxside[2] = skyboxside[3] = skyboxside[4] = skyboxside[5] = NULL;
@@ -780,7 +780,7 @@ void R_SetSkyBox(char *sky)
        skyname[0] = 0;
 
        if (!sky[0])
        skyname[0] = 0;
 
        if (!sky[0])
-               return;
+               return true;
 
        for (i = 0;i < 6;i++)
        {
 
        for (i = 0;i < 6;i++)
        {
@@ -802,7 +802,9 @@ void R_SetSkyBox(char *sky)
        {
                skyavailable_box = true;
                strcpy(skyname, sky);
        {
                skyavailable_box = true;
                strcpy(skyname, sky);
+               return true;
        }
        }
+       return false;
 }
 
 // LordHavoc: added LoadSky console command
 }
 
 // LordHavoc: added LoadSky console command
@@ -814,11 +816,18 @@ void LoadSky_f (void)
                if (skyname[0])
                        Con_Printf("current sky: %s\n", skyname);
                else
                if (skyname[0])
                        Con_Printf("current sky: %s\n", skyname);
                else
-                       Con_Printf("no skybox has been set\n", skyname);
+                       Con_Printf("no skybox has been set\n");
                break;
        case 2:
                break;
        case 2:
-               R_SetSkyBox(Cmd_Argv(1));
-               Con_Printf("skybox set to %s\n", skyname);
+               if (R_SetSkyBox(Cmd_Argv(1)))
+               {
+                       if (skyname[0])
+                               Con_Printf("skybox set to %s\n", skyname);
+                       else
+                               Con_Printf("skybox disabled\n");
+               }
+               else
+                       Con_Printf("failed to load skybox %s\n", Cmd_Argv(1));
                break;
        default:
                Con_Printf("usage: loadsky skyname\n");
                break;
        default:
                Con_Printf("usage: loadsky skyname\n");
index bd8c4f6f919475caf6a9fdb30b154e52616c56af..a7bb414e1226ad163b3ebe2671b4f12e295f2dc6 100644 (file)
--- a/gl_poly.h
+++ b/gl_poly.h
@@ -1,4 +1,5 @@
 
 
+extern int R_SetSkyBox(char* sky);
 extern cvar_t r_skyquality;
 
 #define TPOLYTYPE_ALPHA 0
 extern cvar_t r_skyquality;
 
 #define TPOLYTYPE_ALPHA 0
index b8c9bf546d2401ac960d20abbfdff6cca6029a75..5d8342674ce5c38e7d986fc9b3986c1e9db2cdd2 100644 (file)
--- a/render.h
+++ b/render.h
@@ -20,9 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 // refresh.h -- public interface to refresh functions
 
 
 // refresh.h -- public interface to refresh functions
 
-// sky stuff
-extern void R_SetSkyBox(char* sky);
-
 // far clip distance for scene
 extern cvar_t r_farclip;
 
 // far clip distance for scene
 extern cvar_t r_farclip;