]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_draw.c
cleaned up nearly all of the externs in .c files (moved to appropriate .h files)
[xonotic/darkplaces.git] / gl_draw.c
index f2c94651bde91ce59c5841748f6d4f0a8b53d23b..59ed467ea1ce82fe682c46f7ff38d70cb4f86c79 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -119,16 +119,12 @@ qpic_t    *Draw_CachePic (char *path)
        return &pic->pic;
 }
 
-extern void LoadSky_f(void);
-
 /*
 ===============
 Draw_Init
 ===============
 */
-void rmain_registercvars();
-
-void gl_draw_start()
+void gl_draw_start(void)
 {
        int             i;
 
@@ -150,7 +146,11 @@ void gl_draw_start()
        draw_disc = Draw_PicFromWad ("disc");
 }
 
-void gl_draw_shutdown()
+void gl_draw_shutdown(void)
+{
+}
+
+void gl_draw_newmap(void)
 {
 }
 
@@ -178,7 +178,7 @@ void GL_Draw_Init (void)
        engineversiony = vid.height - 8;
 
        R_Textures_Init();
-       R_RegisterModule("GL_Draw", gl_draw_start, gl_draw_shutdown);
+       R_RegisterModule("GL_Draw", gl_draw_start, gl_draw_shutdown, gl_draw_newmap);
 }
 
 /*
@@ -225,7 +225,10 @@ void Draw_Character (int x, int y, int num)
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        }
 
-       glColor3f(1,1,1);
+       if (lighthalf)
+               glColor3f(0.5f,0.5f,0.5f);
+       else
+               glColor3f(1.0f,1.0f,1.0f);
        glBegin (GL_QUADS);
        glTexCoord2f (fcol, frow);
        glVertex2f (x, y);
@@ -277,7 +280,10 @@ void Draw_String (int x, int y, char *str, int maxlen)
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        }
 
-       glColor3f(1,1,1);
+       if (lighthalf)
+               glColor3f(0.5f,0.5f,0.5f);
+       else
+               glColor3f(1.0f,1.0f,1.0f);
        glBegin (GL_QUADS);
        while (maxlen-- && x < (int) vid.width) // stop rendering when out of characters or room
        {
@@ -306,7 +312,10 @@ void Draw_GenericPic (rtexture_t *tex, float red, float green, float blue, float
 {
        if (!r_render.value)
                return;
-       glColor4f(red,green,blue,alpha);
+       if (lighthalf)
+               glColor4f(red * 0.5f, green * 0.5f, blue * 0.5f, alpha);
+       else
+               glColor4f(red, green, blue, alpha);
        glBindTexture(GL_TEXTURE_2D, R_GetTexture(tex));
        glBegin (GL_QUADS);
        glTexCoord2f (0, 0);glVertex2f (x, y);
@@ -391,7 +400,13 @@ void Draw_Fill (int x, int y, int w, int h, int c)
        if (!r_render.value)
                return;
        glDisable (GL_TEXTURE_2D);
-       glColor3f (host_basepal[c*3]/255.0, host_basepal[c*3+1]/255.0, host_basepal[c*3+2]/255.0);
+       if (lighthalf)
+       {
+               byte *tempcolor = (byte *)&d_8to24table[c];
+               glColor4ub ((byte) (tempcolor[0] >> 1), (byte) (tempcolor[1] >> 1), (byte) (tempcolor[2] >> 1), tempcolor[3]);
+       }
+       else
+               glColor4ubv ((byte *)&d_8to24table[c]);
 
        glBegin (GL_QUADS);
 
@@ -454,7 +469,7 @@ typedef struct showlmp_s
 
 showlmp_t showlmp[SHOWLMP_MAXLABELS];
 
-void SHOWLMP_decodehide()
+void SHOWLMP_decodehide(void)
 {
        int i;
        byte *lmplabel;
@@ -467,7 +482,7 @@ void SHOWLMP_decodehide()
                }
 }
 
-void SHOWLMP_decodeshow()
+void SHOWLMP_decodeshow(void)
 {
        int i, k;
        byte lmplabel[256], picname[256];
@@ -506,7 +521,7 @@ void SHOWLMP_decodeshow()
        showlmp[k].y = y;
 }
 
-void SHOWLMP_drawall()
+void SHOWLMP_drawall(void)
 {
        int i;
        for (i = 0;i < SHOWLMP_MAXLABELS;i++)
@@ -514,7 +529,7 @@ void SHOWLMP_drawall()
                        Draw_Pic(showlmp[i].x, showlmp[i].y, Draw_CachePic(showlmp[i].pic));
 }
 
-void SHOWLMP_clear()
+void SHOWLMP_clear(void)
 {
        int i;
        for (i = 0;i < SHOWLMP_MAXLABELS;i++)