]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_sky.c
reworked rtlighting code to handle transparent water lighting and transparent model...
[xonotic/darkplaces.git] / r_sky.c
diff --git a/r_sky.c b/r_sky.c
index fa9c0df2e5dcef4de198efb8048cc46522198c2f..981ba57c32da2028f9a4370ee84297d0a6c4db2c 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -12,7 +12,7 @@ int skyrendermasked;
 static int skyrendersphere;
 static int skyrenderbox;
 static rtexturepool_t *skytexturepool;
-static char skyname[256];
+static char skyname[MAX_QPATH];
 
 typedef struct suffixinfo_s
 {
@@ -84,18 +84,18 @@ void R_UnloadSkyBox(void)
        }
 }
 
-void R_LoadSkyBox(void)
+int R_LoadSkyBox(void)
 {
        int i, j, success;
        int indices[4] = {0,1,2,3};
-       char name[1024];
-       qbyte *image_rgba;
-       qbyte *temp;
+       char name[MAX_INPUTLINE];
+       unsigned char *image_rgba;
+       unsigned char *temp;
 
        R_UnloadSkyBox();
 
        if (!skyname[0])
-               return;
+               return true;
 
        for (j=0; j<3; j++)
        {
@@ -113,7 +113,7 @@ void R_LoadSkyBox(void)
                                        }
                                }
                        }
-                       temp = Mem_Alloc(tempmempool, image_width*image_height*4);
+                       temp = (unsigned char *)Mem_Alloc(tempmempool, image_width*image_height*4);
                        Image_CopyMux (temp, image_rgba, image_width, image_height, suffix[j][i].flipx, suffix[j][i].flipy, suffix[j][i].flipdiagonal, 4, 4, indices);
                        skyboxside[i] = R_LoadTexture2D(skytexturepool, va("skyboxside%d", i), image_width, image_height, temp, TEXTYPE_RGBA, TEXF_CLAMP | TEXF_PRECACHE, NULL);
                        Mem_Free(image_rgba);
@@ -126,7 +126,9 @@ void R_LoadSkyBox(void)
        }
 
        if (j == 3)
-               Con_Printf ("Failed to load %s as skybox\n", skyname);
+               return false;
+
+       return true;
 }
 
 int R_SetSkyBox(const char *sky)
@@ -142,11 +144,7 @@ int R_SetSkyBox(const char *sky)
 
        strcpy(skyname, sky);
 
-       R_LoadSkyBox();
-
-       if (!skyname[0])
-               return true;
-       return false;
+       return R_LoadSkyBox();
 }
 
 // LordHavoc: added LoadSky console command