From 9b9c48baa0e6d244d69b59d7bc75952db365b750 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 4 Oct 2004 07:24:34 +0000 Subject: [PATCH] progress bar on console about lighting list. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@299 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/console.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/engine/client/console.c b/engine/client/console.c index 6554d5ef5..423e0892d 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -1036,6 +1036,13 @@ void Con_DrawConsole (int lines, qboolean noback) char *txt; int row; unsigned char dlbar[1024]; + char *progresstext; + int progresspercent; + +#ifdef RUNTIMELIGHTING + extern model_t *lightmodel; + extern int relitsurface; +#endif console_t *curcon = con; @@ -1086,14 +1093,34 @@ void Con_DrawConsole (int lines, qboolean noback) } } + progresstext = NULL; + progresspercent = 0; + // draw the download bar // figure out width if (cls.downloadmethod) { - if ((txt = strrchr(cls.downloadname, '/')) != NULL) + progresstext = cls.downloadname; + progresspercent = cls.downloadpercent; + + } +#ifdef RUNTIMELIGHTING + else if (lightmodel) + { + if (relitsurface < lightmodel->numsurfaces) + { + progresstext = "light"; + progresspercent = (relitsurface*100) / lightmodel->numsurfaces; + } + } +#endif + + if (progresstext) + { + if ((txt = strrchr(progresstext, '/')) != NULL) txt++; else - txt = cls.downloadname; + txt = progresstext; x = con->linewidth - ((con->linewidth * 7) / 40); y = x - strlen(txt) - 8; @@ -1110,10 +1137,10 @@ void Con_DrawConsole (int lines, qboolean noback) i = strlen(dlbar); dlbar[i++] = '\x80'; // where's the dot go? - if (cls.downloadpercent == 0) + if (progresspercent == 0) n = 0; else - n = y * (float)cls.downloadpercent / 100; + n = y * (float)progresspercent / 100; x = i; for (j = 0; j < y; j++) @@ -1126,7 +1153,7 @@ void Con_DrawConsole (int lines, qboolean noback) dlbar[i++] = '\x82'; dlbar[i] = 0; - sprintf(dlbar + strlen(dlbar), " %02d%%", cls.downloadpercent); + sprintf(dlbar + strlen(dlbar), " %02d%%", progresspercent); // draw it y = con->vislines-22 + 8; @@ -1136,7 +1163,6 @@ void Con_DrawConsole (int lines, qboolean noback) Draw_Character ((n+1+x)*8, y, '\x83'); } - // draw the input prompt, user text, and cursor if desired Con_DrawInput (); }