[nexuiz-commits] r8045 - in trunk/data: . qcsrc/menu qcsrc/menu/nexuiz qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Oct 4 06:12:35 EDT 2009


Author: div0
Date: 2009-10-04 06:12:35 -0400 (Sun, 04 Oct 2009)
New Revision: 8045

Modified:
   trunk/data/balance.cfg
   trunk/data/balance25.cfg
   trunk/data/balanceHavoc.cfg
   trunk/data/balanceSamual.cfg
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/menu/gamecommand.qc
   trunk/data/qcsrc/menu/menu.qc
   trunk/data/qcsrc/menu/menu.qh
   trunk/data/qcsrc/menu/nexuiz/dialog_settings_video.c
   trunk/data/qcsrc/menu/nexuiz/slider_resolution.c
   trunk/data/qcsrc/server/constants.qh
Log:
menu_vid_scale: add a slider to control size of HUD items, menu font, etc. (conwidth)


Modified: trunk/data/balance.cfg
===================================================================
--- trunk/data/balance.cfg	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/balance.cfg	2009-10-04 10:12:35 UTC (rev 8045)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit the other balance*.cfg too.
 
-set cvar_check_balance 7181a5458cca8abd093e2032a13affb3
+set cvar_check_balance 9b590c8f7c3065d917ac8e2e5e842a88
 
 // {{{ weapon replacement
 // NOTE: this only replaces weapons on the map

Modified: trunk/data/balance25.cfg
===================================================================
--- trunk/data/balance25.cfg	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/balance25.cfg	2009-10-04 10:12:35 UTC (rev 8045)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit the other balance*.cfg too.
 
-set cvar_check_balance 7181a5458cca8abd093e2032a13affb3
+set cvar_check_balance 9b590c8f7c3065d917ac8e2e5e842a88
 
 // {{{ weapon replacement
 // NOTE: this only replaces weapons on the map

Modified: trunk/data/balanceHavoc.cfg
===================================================================
--- trunk/data/balanceHavoc.cfg	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/balanceHavoc.cfg	2009-10-04 10:12:35 UTC (rev 8045)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit the other balance*.cfg too.
 
-set cvar_check_balance 7181a5458cca8abd093e2032a13affb3
+set cvar_check_balance 9b590c8f7c3065d917ac8e2e5e842a88
 
 // {{{ weapon replacement
 // NOTE: this only replaces weapons on the map

Modified: trunk/data/balanceSamual.cfg
===================================================================
--- trunk/data/balanceSamual.cfg	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/balanceSamual.cfg	2009-10-04 10:12:35 UTC (rev 8045)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit the other balance*.cfg too.
 
-set cvar_check_balance 7181a5458cca8abd093e2032a13affb3
+set cvar_check_balance 9b590c8f7c3065d917ac8e2e5e842a88
 
 // {{{ weapon replacement
 // NOTE: this only replaces weapons on the map

Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/defaultNexuiz.cfg	2009-10-04 10:12:35 UTC (rev 8045)
@@ -26,7 +26,7 @@
 seta g_configversion 0	"Configuration file version (used to upgrade settings) 0: first run, or previous start was <2.4.1  Later, it's overridden by config.cfg, version ranges are defined in config_update.cfg"
 
 // default.cfg versioning (update using update-cvarcount.sh, run that every time after adding a new cvar)
-set cvar_check_default c0254c4c1cc8836cd7cc3989f4ad25f4
+set cvar_check_default 091f36c4fb0d7b22bbd2d2fdff8b1447
 
 // Nexuiz version (formatted for machines)
 // used to determine if a client version is compatible
@@ -228,6 +228,11 @@
 vid_fullscreen 1
 vid_width 1024
 vid_height 768
+vid_pixelheight 1
+set menu_vid_width 1024
+set menu_vid_height 768
+set menu_vid_pixelheight 1
+set menu_vid_scale 0
 // 2D resolution 800x600
 vid_conwidth 800
 vid_conheight 600

Modified: trunk/data/qcsrc/menu/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/menu/gamecommand.qc	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/qcsrc/menu/gamecommand.qc	2009-10-04 10:12:35 UTC (rev 8045)
@@ -68,6 +68,12 @@
 		return;
 	}
 
+	if(argv(0) == "videosettings")
+	{
+		m_goto_video_settings();
+		return;
+	}
+
 	if(argv(0) == "dumptree")
 	{
 		_dumptree_space = "";
@@ -75,6 +81,12 @@
 		return;
 	}
 
+	if(argv(0) == "setresolution")
+	{
+		updateConwidths();
+		return;
+	}
+
 #if 0
 	if(argv(0) == "tokentest")
 	{

Modified: trunk/data/qcsrc/menu/menu.qc
===================================================================
--- trunk/data/qcsrc/menu/menu.qc	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/qcsrc/menu/menu.qc	2009-10-04 10:12:35 UTC (rev 8045)
@@ -789,3 +789,11 @@
 	// TODO add code to switch back to the skin selector (no idea how to do it now)
 	m_goto("skinselector");
 }
+
+void() m_goto_video_settings =
+{
+	if(!menuInitialized)
+		return;
+	// TODO add code to switch back to the skin selector (no idea how to do it now)
+	m_goto("videosettings");
+}

Modified: trunk/data/qcsrc/menu/menu.qh
===================================================================
--- trunk/data/qcsrc/menu/menu.qh	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/qcsrc/menu/menu.qh	2009-10-04 10:12:35 UTC (rev 8045)
@@ -31,6 +31,7 @@
 void m_display();
 void m_goto(string name);
 void m_goto_skin_selector();
+void m_goto_video_settings();
 .string name;
 
 entity keyGrabber;

Modified: trunk/data/qcsrc/menu/nexuiz/dialog_settings_video.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_settings_video.c	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_settings_video.c	2009-10-04 10:12:35 UTC (rev 8045)
@@ -5,6 +5,7 @@
 	ATTRIB(NexuizVideoSettingsTab, intendedWidth, float, 0.9)
 	ATTRIB(NexuizVideoSettingsTab, rows, float, 17)
 	ATTRIB(NexuizVideoSettingsTab, columns, float, 6.5)
+	ATTRIB(NexuizVideoSettingsTab, name, string, "videosettings")
 ENDCLASS(NexuizVideoSettingsTab)
 entity makeNexuizVideoSettingsTab();
 #endif
@@ -25,6 +26,19 @@
 		me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Resolution:"));
 		me.TD(me, 1, 2, e = makeNexuizResolutionSlider());
 	me.TR(me);
+		me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Font/UI size:"));
+		me.TD(me, 1, 2, e = makeNexuizTextSlider("menu_vid_scale"));
+			e.addValue(e, "Unreadable", "-1");
+			e.addValue(e, "Tiny", "-0.75");
+			e.addValue(e, "Little", "-0.5");
+			e.addValue(e, "Small", "-0.25");
+			e.addValue(e, "Medium", "0");
+			e.addValue(e, "Large", "0.25");
+			e.addValue(e, "Huge", "0.5");
+			e.addValue(e, "Gigantic", "0.75");
+			e.addValue(e, "Colossal", "1");
+			e.configureNexuizTextSliderValues(e);
+	me.TR(me);
 		me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Color depth:"));
 		me.TD(me, 1, 2, e = makeNexuizSlider(16, 32, 16, "vid_bitsperpixel"));
 	me.TR(me);
@@ -93,6 +107,6 @@
 		me.TD(me, 1, 2, e = makeNexuizSlider(0.5, 2.0, 0.05, "r_hdr_scenebrightness"));
 
 	me.gotoRC(me, me.rows - 1, 0);
-		me.TD(me, 1, me.columns, makeNexuizCommandButton("Apply immediately", '0 0 0', "vid_conwidth $menu_vid_conwidth; vid_conheight $menu_vid_conheight; vid_restart", COMMANDBUTTON_APPLY));
+		me.TD(me, 1, me.columns, makeNexuizCommandButton("Apply immediately", '0 0 0', "menu_cmd setresolution; vid_restart; menu_restart; togglemenu; defer 0.1 \"menu_cmd videosettings\"", COMMANDBUTTON_APPLY));
 }
 #endif

Modified: trunk/data/qcsrc/menu/nexuiz/slider_resolution.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/slider_resolution.c	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/qcsrc/menu/nexuiz/slider_resolution.c	2009-10-04 10:12:35 UTC (rev 8045)
@@ -1,14 +1,58 @@
 #ifdef INTERFACE
 CLASS(NexuizResolutionSlider) EXTENDS(NexuizTextSlider)
 	METHOD(NexuizResolutionSlider, configureNexuizResolutionSlider, void(entity))
-	METHOD(NexuizResolutionSlider, addResolution, void(entity, float, float, float, float))
+	METHOD(NexuizResolutionSlider, addResolution, void(entity, float, float, float))
 	METHOD(NexuizResolutionSlider, loadCvars, void(entity))
 	METHOD(NexuizResolutionSlider, saveCvars, void(entity))
 ENDCLASS(NexuizResolutionSlider)
 entity makeNexuizResolutionSlider();
+void updateConwidths();
 #endif
 
 #ifdef IMPLEMENTATION
+void updateConwidths()
+{
+	vector r, c;
+	float minfactor, maxfactor;
+	float sz, f;
+	r_x = cvar("menu_vid_width");
+	r_y = cvar("menu_vid_height");
+	r_z = cvar("menu_vid_pixelheight");
+	sz = cvar("menu_vid_scale");
+
+	// calculate the base resolution
+	c_z = 0;
+	c_x = 800;
+	c_y = c_x * r_y * r_z / r_x;
+	if(c_y < 600)
+	{
+		c_y = 600;
+		c_x = c_y * r_x / (r_y * r_z);
+	}
+
+	f = min(r_x / c_x, r_y / c_y);
+	if(f < 1)
+		c = c * f; // ensures that c_x <= r_x and c_y <= r_y
+
+	minfactor = min(1, 640 / c_x);             // can be > 1 only if c_x is <640
+	maxfactor = max3(1, r_x / c_x, r_y / c_y); // can be < 1 only if r_x < c_x and r_y < c_y
+	dprint("min factor: ", ftos(minfactor), "\n");
+	dprint("max factor: ", ftos(maxfactor), "\n");
+
+	if(sz < 0)
+		f = 1 - (maxfactor - 1) * sz;
+	else if(sz > 0)
+		f = 1 + (minfactor - 1) * sz;
+	else
+		f = 1;
+	c *= f;
+
+	cvar_set("vid_width", ftos(rint(r_x)));
+	cvar_set("vid_height", ftos(rint(r_y)));
+	cvar_set("vid_pixelheight", ftos(rint(r_z)));
+	cvar_set("vid_conwidth", ftos(rint(c_x)));
+	cvar_set("vid_conheight", ftos(rint(c_y)));
+}
 entity makeNexuizResolutionSlider()
 {
 	entity me;
@@ -16,64 +60,48 @@
 	me.configureNexuizResolutionSlider(me);
 	return me;
 }
-void addResolutionNexuizResolutionSlider(entity me, float w, float h, float cw, float ch)
+void addResolutionNexuizResolutionSlider(entity me, float w, float h, float pixelheight)
 {
-	float f;
-	f = max(cw / w, ch / h);
-	if(f > 1)
-	{
-		cw = rint(cw / f);
-		ch = rint(ch / f);
-	}
-	me.addValue(me, strzone(strcat(ftos(w), "x", ftos(h))), strzone(strcat(ftos(w), " ", ftos(h), " ", ftos(cw), " ", ftos(ch))));
+	me.addValue(me, strzone(strcat(ftos(w), "x", ftos(h))), strzone(strcat(ftos(w), " ", ftos(h), " ", ftos(pixelheight))));
 	// FIXME (in case you ever want to dynamically instantiate this): THIS IS NEVER FREED
 }
 void configureNexuizResolutionSliderNexuizResolutionSlider(entity me)
 {
 	float i;
-	vector r0, r, c;
+	vector r0, r;
 
-	me.configureNexuizTextSlider(me, "vid_width");
+	me.configureNexuizTextSlider(me, "menu_vid_width");
 
-	c = '0 0 0';
 	r0 = '0 0 0';
 	for(i = 0;; ++i)
 	{
 		r = getresolution(i);
 		if(r_x == 0 && r_y == 0)
 			break;
+		if(r_z == 0)
+			r_z = 1; // compat
 		if(r == r0)
 			continue;
 		r0 = r;
 		if(r_x < 640 || r_y < 400)
 			continue;
-		c_x = 800;
-		c_y = rint(c_x * r_y / r_x);
-		if(c_y >= 600)
-		{
-			me.addResolution(me, r_x, r_y, c_x, c_y);
-			continue;
-		}
-		c_y = 600;
-		c_x = rint(c_y * r_x / r_y);
-		me.addResolution(me, r_x, r_y, c_x, c_y);
+		me.addResolution(me, r_x, r_y, r_z);
 	}
 
 	me.configureNexuizTextSliderValues(me);
 }
 void loadCvarsNexuizResolutionSlider(entity me)
 {
-	me.setValueFromIdentifier(me, strcat(cvar_string("vid_width"), " ", cvar_string("vid_height"), " ", cvar_string("menu_vid_conwidth"), " ", cvar_string("menu_vid_conheight")));
+	me.setValueFromIdentifier(me, strcat(cvar_string("menu_vid_width"), " ", cvar_string("menu_vid_height"), " ", cvar_string("menu_vid_pixelheight")));
 }
 void saveCvarsNexuizResolutionSlider(entity me)
 {
 	if(me.value >= 0 || me.value < me.nValues)
 	{
 		tokenize_console(me.getIdentifier(me));
-		cvar_set("vid_width", argv(0));
-		cvar_set("vid_height", argv(1));
-		cvar_set("menu_vid_conwidth", argv(2));
-		cvar_set("menu_vid_conheight", argv(3));
+		cvar_set("menu_vid_width", argv(0));
+		cvar_set("menu_vid_height", argv(1));
+		cvar_set("menu_vid_pixelheight", argv(2));
 	}
 }
 #endif

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2009-10-04 00:57:15 UTC (rev 8044)
+++ trunk/data/qcsrc/server/constants.qh	2009-10-04 10:12:35 UTC (rev 8045)
@@ -1,5 +1,5 @@
-string CVAR_CHECK_DEFAULT = "c0254c4c1cc8836cd7cc3989f4ad25f4";
-string CVAR_CHECK_BALANCE = "7181a5458cca8abd093e2032a13affb3";
+string CVAR_CHECK_DEFAULT = "091f36c4fb0d7b22bbd2d2fdff8b1447";
+string CVAR_CHECK_BALANCE = "9b590c8f7c3065d917ac8e2e5e842a88";
 
 float	FALSE					= 0;
 float	TRUE					= 1;



More information about the nexuiz-commits mailing list