r5318 - in trunk/data/qcsrc: common menu/item menu/nexuiz

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Dec 26 11:54:50 EST 2008


Author: div0
Date: 2008-12-26 11:54:49 -0500 (Fri, 26 Dec 2008)
New Revision: 5318

Modified:
   trunk/data/qcsrc/common/gamecommand.qc
   trunk/data/qcsrc/menu/item/inputbox.c
   trunk/data/qcsrc/menu/nexuiz/colorpicker.c
Log:
fix the test command;
fix display of the color picker with text brightness/contrast


Modified: trunk/data/qcsrc/common/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/common/gamecommand.qc	2008-12-26 15:56:57 UTC (rev 5317)
+++ trunk/data/qcsrc/common/gamecommand.qc	2008-12-26 16:54:49 UTC (rev 5318)
@@ -144,7 +144,7 @@
 	else if(argv(0) == "BRLOGENSHFEGLE" && argc >= 2)
 	{
 		// test case for terrencehill's color codes
-		s = substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2));
+		s = strdecolorize(substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
 		s2 = "";
 		n = strlen(s);
 		

Modified: trunk/data/qcsrc/menu/item/inputbox.c
===================================================================
--- trunk/data/qcsrc/menu/item/inputbox.c	2008-12-26 15:56:57 UTC (rev 5317)
+++ trunk/data/qcsrc/menu/item/inputbox.c	2008-12-26 16:54:49 UTC (rev 5318)
@@ -165,17 +165,13 @@
 		vector theColor;
 		float theAlpha;    //float theVariableAlpha;
 		vector p;
-		float brightness, contrast;
 		vector theTempColor;
 		float component;
 		
-		brightness = cvar("r_textbrightness");
-		contrast = cvar("r_textcontrast");
 		p = me.realOrigin - eX * me.scrollPos;
 		theColor = '1 1 1';
 		theAlpha = 1;    //theVariableAlpha = 1; // changes when ^ax found
 		
-		theColor = theColor * contrast + '1 1 1' * brightness;
 		for(i = 0; i < strlen(me.text); ++i)
 		{
 			ch = substring(me.text, i, 1);
@@ -204,7 +200,6 @@
 						case 8: theColor = '1 1 1'; theAlpha = 0.5; break;
 						case 9: theColor = '0.5 0.5 0.5'; theAlpha = 1; break;
 					}
-					theColor = theColor * contrast + '1 1 1' * brightness;
 					draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5);
 					draw_Text(p, strcat(ch, ch2), me.realFontSize, theColor, theAlpha, 0);
 				}
@@ -227,7 +222,7 @@
 							if (component >= 0) // ^xrgb found
 							{
 								theTempColor_z = component/15;
-								theColor = theTempColor * contrast + '1 1 1' * brightness;
+								theColor = theTempColor;
 								w = draw_TextWidth(substring(me.text, i, 5), 0) * me.realFontSize_x;
 								
 								draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5);

Modified: trunk/data/qcsrc/menu/nexuiz/colorpicker.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/colorpicker.c	2008-12-26 15:56:57 UTC (rev 5317)
+++ trunk/data/qcsrc/menu/nexuiz/colorpicker.c	2008-12-26 16:54:49 UTC (rev 5318)
@@ -10,6 +10,7 @@
 	ATTRIB(NexuizColorpicker, focusable, float, 1)
 	METHOD(NexuizColorpicker, focusLeave, void(entity))
 	METHOD(NexuizColorpicker, keyDown, float(entity, float, float, float))
+	METHOD(NexuizColorpicker, draw, void(entity))
 ENDCLASS(NexuizColorpicker)
 entity makeNexuizColorpicker(entity theTextbox);
 #endif
@@ -110,4 +111,23 @@
 {
 	return me.controlledTextbox.keyDown(me.controlledTextbox, key, ascii, shift);
 }
+void drawNexuizColorpicker(entity me)
+{
+	drawImage(me);
+	float B, C, aC;
+	C = cvar("r_textcontrast");
+	B = cvar("r_textbrightness");
+
+	// for this to work, C/(1-B) must be in 0..1
+	// B must be < 1
+	// C must be < 1-B
+	
+	B = bound(0, B, 1);
+	C = bound(0, C, 1-B);
+
+	aC = 1 - C / (1 - B);
+
+	draw_Fill('0 0 0', '1 1 0', '0 0 0', aC);
+	draw_Fill('0 0 0', '1 1 0', '1 1 1', B);
+}
 #endif




More information about the nexuiz-commits mailing list