]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
new cvars:
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 Jun 2010 14:46:47 +0000 (14:46 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 Jun 2010 14:46:47 +0000 (14:46 +0000)
scr_conalpha2factor (relative alpha for gfx/conback2)
scr_conscroll_x (like tcmod scroll on console background)
scr_conscroll_y
scr_conscroll2_x (like tcmod scroll on second console background)
scr_conscroll2_y

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10256 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
console.c
gl_draw.c
screen.h

index 2204d3a368ec85d1a8185f6c91a69ac1e4f3aca0..ce9c10569a42eda05970315780fc9c4488b7ca77 100644 (file)
 
 cvar_t scr_viewsize = {CVAR_SAVE, "viewsize","100", "how large the view should be, 110 disables inventory bar, 120 disables status bar"};
 cvar_t scr_fov = {CVAR_SAVE, "fov","90", "field of vision, 1-170 degrees, default 90, some players use 110-130"};
-cvar_t scr_conalpha = {CVAR_SAVE, "scr_conalpha", "1", "opacity of console background"};
+cvar_t scr_conalpha = {CVAR_SAVE, "scr_conalpha", "1", "opacity of console background gfx/conback"};
+cvar_t scr_conalpha2factor = {CVAR_SAVE, "scr_conalpha2factor", "0", "opacity of console background gfx/conback2 relative to gfx/conback; when 0, gfx/conback2 is not drawn"};
 cvar_t scr_conbrightness = {CVAR_SAVE, "scr_conbrightness", "1", "brightness of console background (0 = black, 1 = image)"};
 cvar_t scr_conforcewhiledisconnected = {0, "scr_conforcewhiledisconnected", "1", "forces fullscreen console while disconnected"};
+cvar_t scr_conscroll_x = {CVAR_SAVE, "scr_conscroll_x", "0", "scroll speed of gfx/conback in x direction"};
+cvar_t scr_conscroll_y = {CVAR_SAVE, "scr_conscroll_y", "0", "scroll speed of gfx/conback in y direction"};
+cvar_t scr_conscroll2_x = {CVAR_SAVE, "scr_conscroll_x", "0", "scroll speed of gfx/conback2 in x direction"};
+cvar_t scr_conscroll2_y = {CVAR_SAVE, "scr_conscroll_y", "0", "scroll speed of gfx/conback2 in y direction"};
 cvar_t scr_menuforcewhiledisconnected = {0, "scr_menuforcewhiledisconnected", "0", "forces menu while disconnected"};
 cvar_t scr_centertime = {0, "scr_centertime","2", "how long centerprint messages show"};
 cvar_t scr_showram = {CVAR_SAVE, "showram","1", "show ram icon if low on surface cache memory (not used)"};
@@ -853,6 +858,11 @@ void CL_Screen_Init(void)
        Cvar_RegisterVariable (&scr_fov);
        Cvar_RegisterVariable (&scr_viewsize);
        Cvar_RegisterVariable (&scr_conalpha);
+       Cvar_RegisterVariable (&scr_conalpha2factor);
+       Cvar_RegisterVariable (&scr_conscroll_x);
+       Cvar_RegisterVariable (&scr_conscroll_y);
+       Cvar_RegisterVariable (&scr_conscroll2_x);
+       Cvar_RegisterVariable (&scr_conscroll2_y);
        Cvar_RegisterVariable (&scr_conbrightness);
        Cvar_RegisterVariable (&scr_conforcewhiledisconnected);
        Cvar_RegisterVariable (&scr_menuforcewhiledisconnected);
index d6d4ab3432401d0c368109f9438607970852f93f..78f6c0c559e8fe7690c8113f9da17c5ad08b0757 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1822,6 +1822,8 @@ The typing input line at the bottom should only be drawn if typing is allowed
 */
 void Con_DrawConsole (int lines)
 {
+       float alpha;
+       double sx, sy;
        int mask_must = 0;
        int mask_mustnot = (developer.integer>0) ? 0 : CON_MASK_DEVELOPER;
        cachepic_t *conbackpic;
@@ -1835,11 +1837,40 @@ void Con_DrawConsole (int lines)
        con_vislines = lines;
 
 // draw the background
-       conbackpic = scr_conbrightness.value >= 0.01f ? Draw_CachePic("gfx/conback") : NULL;
-       if (conbackpic && conbackpic->tex != r_texture_notexture)
-               DrawQ_Pic(0, lines - vid_conheight.integer, conbackpic, vid_conwidth.integer, vid_conheight.integer, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, cls.signon == SIGNONS ? scr_conalpha.value : 1.0f, 0); // always full alpha when not in game
-       else
-               DrawQ_Fill(0, lines - vid_conheight.integer, vid_conwidth.integer, vid_conheight.integer, 0.0f, 0.0f, 0.0f, cls.signon == SIGNONS ? scr_conalpha.value : 1.0f, 0); // always full alpha when not in game
+       alpha = cls.signon == SIGNONS ? scr_conalpha.value : 1.0f; // always full alpha when not in game
+       if(alpha > 0)
+       {
+               sx = scr_conscroll_x.value;
+               sy = scr_conscroll_y.value;
+               conbackpic = scr_conbrightness.value >= 0.01f ? Draw_CachePic_Flags("gfx/conback", (sx != 0 || sy != 0) ? CACHEPICFLAG_NOCLAMP : 0) : NULL;
+               sx *= realtime; sy *= realtime;
+               sx -= floor(sx); sy -= floor(sy);
+               if (conbackpic && conbackpic->tex != r_texture_notexture)
+                       DrawQ_SuperPic(0, lines - vid_conheight.integer, conbackpic, vid_conwidth.integer, vid_conheight.integer,
+                                       0 + sx, 0 + sy, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, alpha,
+                                       1 + sx, 0 + sy, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, alpha,
+                                       0 + sx, 1 + sy, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, alpha,
+                                       1 + sx, 1 + sy, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, alpha,
+                                       0);
+               else
+                       DrawQ_Fill(0, lines - vid_conheight.integer, vid_conwidth.integer, vid_conheight.integer, 0.0f, 0.0f, 0.0f, alpha, 0);
+               alpha *= scr_conalpha2factor.value;
+       }
+       if(alpha > 0)
+       {
+               sx = scr_conscroll2_x.value;
+               sy = scr_conscroll2_y.value;
+               conbackpic = Draw_CachePic_Flags("gfx/conback2", (sx != 0 || sy != 0) ? CACHEPICFLAG_NOCLAMP : 0);
+               sx *= realtime; sy *= realtime;
+               sx -= floor(sx); sy -= floor(sy);
+               if(conbackpic && conbackpic->tex != r_texture_notexture)
+                       DrawQ_SuperPic(0, lines - vid_conheight.integer, conbackpic, vid_conwidth.integer, vid_conheight.integer,
+                                       0 + sx, 0 + sy, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, alpha,
+                                       1 + sx, 0 + sy, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, alpha,
+                                       0 + sx, 1 + sy, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, alpha,
+                                       1 + sx, 1 + sy, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, alpha,
+                                       0);
+       }
        DrawQ_String(vid_conwidth.integer - DrawQ_TextWidth(engineversion, 0, con_textsize.value, con_textsize.value, false, FONT_CONSOLE), lines - con_textsize.value, engineversion, 0, con_textsize.value, con_textsize.value, 1, 0, 0, 1, 0, NULL, true, FONT_CONSOLE);
 
 // draw the text
index faa0c9180fa473a5c06bff3972f696c096a06831..36fcac778854bd0e5d863f3147dc2fbe8312ce3c 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -317,13 +317,21 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
        fs_offset_t lmpsize;
        unsigned char *lmpdata;
        char lmpname[MAX_QPATH];
+       int texflags;
+
+       texflags = TEXF_ALPHA;
+       if (!(cachepicflags & CACHEPICFLAG_NOCLAMP))
+               texflags |= TEXF_CLAMP;
+       if (!(cachepicflags & CACHEPICFLAG_NOCOMPRESSION) && gl_texturecompression_2d.integer)
+               texflags |= TEXF_COMPRESS;
 
        // check whether the picture has already been cached
        crc = CRC_Block((unsigned char *)path, strlen(path));
        hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE;
        for (pic = cachepichash[hashkey];pic;pic = pic->chain)
                if (!strcmp (path, pic->name))
-                       return pic;
+                       if(pic->texflags == texflags)
+                               return pic;
 
        if (numcachepics == MAX_CACHED_PICS)
        {
@@ -347,12 +355,7 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
                return pic;
        }
 
-       pic->texflags = TEXF_ALPHA;
-       if (!(cachepicflags & CACHEPICFLAG_NOCLAMP))
-               pic->texflags |= TEXF_CLAMP;
-       if (!(cachepicflags & CACHEPICFLAG_NOCOMPRESSION) && gl_texturecompression_2d.integer)
-               pic->texflags |= TEXF_COMPRESS;
-
+       pic->texflags = texflags;
        pic->autoload = (cachepicflags & CACHEPICFLAG_NOTPERSISTENT);
 
        // load a high quality image from disk if possible
index 17d085179862966ab976fe3a4c35d354d0906cf8..a8fbb14825c916a51d1300403ecb437756fc342d 100644 (file)
--- a/screen.h
+++ b/screen.h
@@ -51,6 +51,11 @@ extern cvar_t crosshair;
 extern cvar_t crosshair_size;
 
 extern cvar_t scr_conalpha;
+extern cvar_t scr_conalpha2factor;
+extern cvar_t scr_conscroll_x;
+extern cvar_t scr_conscroll_y;
+extern cvar_t scr_conscroll2_x;
+extern cvar_t scr_conscroll2_y;
 extern cvar_t scr_conbrightness;
 extern cvar_t r_letterbox;