r4428 - in branches/nexuiz-2.0: . data data/gfx/menu/default data/qcsrc/client data/qcsrc/common data/qcsrc/menu data/qcsrc/menu/item data/qcsrc/menu/nexuiz data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Sep 9 03:05:17 EDT 2008


Author: div0
Date: 2008-09-09 03:05:14 -0400 (Tue, 09 Sep 2008)
New Revision: 4428

Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/data/defaultNexuiz.cfg
   branches/nexuiz-2.0/data/gfx/menu/default/skinvalues.txt
   branches/nexuiz-2.0/data/keybinds.txt
   branches/nexuiz-2.0/data/qcsrc/client/Main.qc
   branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
   branches/nexuiz-2.0/data/qcsrc/common/util.qc
   branches/nexuiz-2.0/data/qcsrc/common/util.qh
   branches/nexuiz-2.0/data/qcsrc/menu/classes.c
   branches/nexuiz-2.0/data/qcsrc/menu/item/listbox.c
   branches/nexuiz-2.0/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c
   branches/nexuiz-2.0/data/qcsrc/menu/nexuiz/mainwindow.c
   branches/nexuiz-2.0/data/qcsrc/menu/skin-customizables.inc
   branches/nexuiz-2.0/data/qcsrc/server/cl_impulse.qc
   branches/nexuiz-2.0/data/qcsrc/server/cl_player.qc
   branches/nexuiz-2.0/data/qcsrc/server/cl_weapons.qc
   branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc
   branches/nexuiz-2.0/data/qcsrc/server/defs.qh
   branches/nexuiz-2.0/data/qcsrc/server/portals.qc
   branches/nexuiz-2.0/data/qcsrc/server/race.qc
   branches/nexuiz-2.0/data/qcsrc/server/sv_main.qc
   branches/nexuiz-2.0/data/qcsrc/server/w_porto.qc
Log:
r4417 | div0 | 2008-09-08 19:51:33 +0200 (Mon, 08 Sep 2008) | 2 lines
fix a portal crash
r4418 | div0 | 2008-09-08 20:08:53 +0200 (Mon, 08 Sep 2008) | 2 lines
check if the player touches a checkpoint, and ignore portal shooting while in one
r4419 | esteel | 2008-09-08 21:27:38 +0200 (Mon, 08 Sep 2008) | 2 lines
the warmup marker shall always be visible in the upperright corner
r4420 | div0 | 2008-09-09 07:32:56 +0200 (Tue, 09 Sep 2008) | 2 lines
cl_weaponpriority_useforcycling; if that is off, the current HUD is used to determine weapon cycling order
r4421 | div0 | 2008-09-09 07:34:46 +0200 (Tue, 09 Sep 2008) | 2 lines
fixes for the last commit :P (typos)
r4422 | div0 | 2008-09-09 07:36:14 +0200 (Tue, 09 Sep 2008) | 2 lines
add "weapbest" alias
r4423 | div0 | 2008-09-09 07:42:13 +0200 (Tue, 09 Sep 2008) | 2 lines
typos... :P
r4424 | div0 | 2008-09-09 07:43:19 +0200 (Tue, 09 Sep 2008) | 2 lines
workarounds for fteqcc ?: bug
r4425 | div0 | 2008-09-09 08:46:06 +0200 (Tue, 09 Sep 2008) | 2 lines
Add a weapon priority menu item
r4426 | div0 | 2008-09-09 08:48:23 +0200 (Tue, 09 Sep 2008) | 2 lines
fix skinvalues.txt of the default skin
r4427 | div0 | 2008-09-09 08:53:16 +0200 (Tue, 09 Sep 2008) | 2 lines
add weapbest to keybinds.txt

Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/.patchsets	2008-09-09 07:05:14 UTC (rev 4428)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-4415
+revisions_applied = 1-4427

Modified: branches/nexuiz-2.0/data/defaultNexuiz.cfg
===================================================================
--- branches/nexuiz-2.0/data/defaultNexuiz.cfg	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/defaultNexuiz.cfg	2008-09-09 07:05:14 UTC (rev 4428)
@@ -596,9 +596,27 @@
 alias -zoom -button4
 alias +crouch +button5
 alias -crouch -button5
-alias weapnext "impulse 10"
+alias weapnext "_weapnext_${_supports_weaponpriority}${sbar_hudselector}${cl_weaponpriority_useforcycling}"
+alias _weapnext_000 "impulse 10"
+alias _weapnext_001 "impulse 10"
+alias _weapnext_010 "impulse 10"
+alias _weapnext_011 "impulse 10"
+alias _weapnext_100 "impulse 10"
+alias _weapnext_101 "impulse 15"
+alias _weapnext_110 "impulse 18"
+alias _weapnext_111 "impulse 15"
 alias weaplast "impulse 11"
-alias weapprev "impulse 12"
+alias weapprev "_weapprev_${_supports_weaponpriority}${sbar_hudselector}${cl_weaponpriority_useforcycling}"
+alias _weapprev_000 "impulse 12"
+alias _weapprev_001 "impulse 12"
+alias _weapprev_010 "impulse 12"
+alias _weapprev_011 "impulse 12"
+alias _weapprev_100 "impulse 12"
+alias _weapprev_101 "impulse 16"
+alias _weapprev_110 "impulse 19"
+alias _weapprev_111 "impulse 16"
+set _supports_weaponpriority 0 // set to 1 by csqc if supported, and to 0 on disconnect
+alias weapbest "impulse 13"
 
 // movement
 bind w +forward
@@ -1089,6 +1107,7 @@
 alias allready "sv_cmd allready"
 
 seta cl_weaponpriority "10 9 8 11 7 6 5 4 3 2 1"
+seta cl_weaponpriority_useforcycling 0
 // impulse 200, 210, 220:
 seta cl_weaponpriority0 "9 8 4"      // explosives    (RL Hagar Mortar)
 // impulse 201, 211, 221:

Modified: branches/nexuiz-2.0/data/gfx/menu/default/skinvalues.txt
===================================================================
--- branches/nexuiz-2.0/data/gfx/menu/default/skinvalues.txt	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/gfx/menu/default/skinvalues.txt	2008-09-09 07:05:14 UTC (rev 4428)
@@ -15,6 +15,7 @@
 COLOR_DIALOG_USERBIND           '0.7 0.7 1'
 COLOR_DIALOG_SINGLEPLAYER       '1 1 0.7'
 COLOR_DIALOG_CREDITS            '0.7 0.7 1'
+COLOR_DIALOG_WEAPONS            '1 0.7 0.7'
 
 // nexposee positions of windows (they are the scale transformation
 // centers, NOT the actual positions of the windows!)

Modified: branches/nexuiz-2.0/data/keybinds.txt
===================================================================
--- branches/nexuiz-2.0/data/keybinds.txt	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/keybinds.txt	2008-09-09 07:05:14 UTC (rev 4428)
@@ -15,6 +15,7 @@
 "weapprev"                              "previous"
 "weapnext"                              "next"
 "weaplast"                              "previously used"
+"weapbest"                              "best"
 "impulse 1"                             "laser"
 "impulse 2"                             "shotgun"
 "impulse 3"                             "machine gun"

Modified: branches/nexuiz-2.0/data/qcsrc/client/Main.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/Main.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/client/Main.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -4,6 +4,27 @@
 
 #define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
 
+void cvar_settemp(string cvar, string val)
+{
+	entity e;
+	for(e = world; (e = find(e, classname, "saved_cvar_value")); )
+		if(e.netname == cvar)
+			goto saved;
+	e = spawn();
+	e.classname = "saved_cvar_value";
+	e.netname = strzone(cvar);
+	e.message = strzone(cvar_string(cvar));
+:saved
+	cvar_set(cvar, val);
+}
+
+void cvar_settemp_restore()
+{
+	entity e;
+	for(e = world; (e = find(e, classname, "saved_cvar_value")); )
+			cvar_set(e.netname, e.message);
+}
+
 void() menu_show_error =
 {
 	drawstring('0 200 0', "ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!", '8 8 0', '1 0 0', 1, 0);
@@ -89,6 +110,8 @@
 	players = Sort_Spawn();
 	
 	GetTeam(COLOR_SPECTATOR, true); // add specs first
+
+	cvar_settemp("_supports_weaponpriority", "1");
 }
 
 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
@@ -105,9 +128,7 @@
 	remove(players);
 	db_close(configdb);
 
-	entity e;
-	for(e = world; (e = find(e, classname, "saved_cvar_value")); )
-			cvar_set(e.netname, e.message);
+	cvar_settemp_restore();
 }
 
 .float has_team;
@@ -273,16 +294,7 @@
 		return true;
 	}
 	else if(cmd == "settemp") {
-		entity e;
-		for(e = world; (e = find(e, classname, "saved_cvar_value")); )
-			if(e.netname == argv(1))
-				goto saved;
-		e = spawn();
-		e.classname = "saved_cvar_value";
-		e.netname = strzone(argv(1));
-		e.message = strzone(cvar_string(argv(1)));
-:saved
-		cvar_set(argv(1), argv(2));
+		cvar_settemp(argv(1), argv(2));
 	}
 	
 	return false;

Modified: branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -934,13 +934,6 @@
 
 	pos_y += 1.5 * sbar_fontsize_y;
 	drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - sbar_fontsize_x * stringwidth(str, TRUE)), str, sbar_fontsize, 0.8, 0);
-
-	if(warmup_stage) 
-	{
-		str = "^1Currently just warmup phase";
-		pos_y += 1.5 * sbar_fontsize_y;
-		drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - sbar_fontsize_x * stringwidth(str, TRUE)), str, sbar_fontsize, 0.8, 0);
-	}
 	
 	sbar = sbar_save;
 }
@@ -1335,14 +1328,27 @@
 	float i;
 	float x, fade;
 	float stat_items, stat_weapons;
+	vector o; o = '1 0 0' * vid_conwidth;
+	string s;
 
 	sbar_fontsize = Sbar_GetFontsize();
+	
+	if(warmup_stage) 
+	{
+		s = "^7Currently just ^1warmup^7 phase";
+		dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
+		drawcolorcodedstring(
+			o - sbar_fontsize_x * '1 0 0' * stringwidth(s, TRUE),
+			s,
+			sbar_fontsize,
+			sbar_alpha_fg,
+			0
+		);
+		o += sbar_fontsize_y * '0 1 0';
+	}
 
 	if(spectatee_status)
 	{
-		string s;
-		vector o;
-		o = '1 0 0' * vid_conwidth;
 		if(spectatee_status == -1)
 			s = "^1Observing";
 		else
@@ -1410,7 +1416,7 @@
 		);
 		o += sbar_fontsize_y * '0 1 0';
 	}
-	
+		
 	//Sbar_SortFrags();
 	Sbar_UpdatePlayerTeams();
 
@@ -1606,7 +1612,7 @@
 				//   to the right!
 			}
 		
-		
+
 			if(gametype == GAME_KEYHUNT)
 			{
 				CSQC_kh_hud();

Modified: branches/nexuiz-2.0/data/qcsrc/common/util.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/common/util.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/common/util.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -640,3 +640,57 @@
 	makevectors(a);
 }
 #endif
+
+string fixPriorityList(string order, float from, float to, float complete)
+{
+	string neworder;
+	float i, n, w;
+
+	n = tokenize(order);
+	for(i = 0; i < n; ++i)
+	{
+		w = stof(argv(i));
+		if(w >= from && w <= to && w == floor(w))
+			neworder = strcat(neworder, ftos(w), " ");
+	}
+
+	if(complete)
+	{
+		n = tokenize(neworder);
+		for(w = to; w >= from; --w)
+		{
+			for(i = 0; i < n; ++i)
+				if(stof(argv(i)) == w)
+					break;
+			if(i == n) // not found
+				neworder = strcat(neworder, ftos(w), " ");
+		}
+	}
+	
+	return substring(neworder, 0, strlen(neworder) - 1);
+}
+
+string swapInPriorityList(string order, float i, float j)
+{
+	string s;
+	float w, n;
+
+	n = tokenize(order);
+
+	if(i >= 0 && i < n && j >= 0 && j < n && i != j)
+	{
+		s = "";
+		for(w = 0; w < n; ++w)
+		{
+			if(w == i)
+				s = strcat(s, argv(j), " ");
+			else if(w == j)
+				s = strcat(s, argv(i), " ");
+			else
+				s = strcat(s, argv(w), " ");
+		}
+		return substring(s, 0, strlen(s) - 1);
+	}
+	
+	return order;
+}

Modified: branches/nexuiz-2.0/data/qcsrc/common/util.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/common/util.qh	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/common/util.qh	2008-09-09 07:05:14 UTC (rev 4428)
@@ -73,3 +73,6 @@
 #define fixedvectoangles2 vectoangles2
 #define fixedvectoangles vectoangles
 #endif
+
+string fixPriorityList(string pl, float from, float to, float complete);
+string swapInPriorityList(string order, float i, float j);

Modified: branches/nexuiz-2.0/data/qcsrc/menu/classes.c
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/menu/classes.c	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/menu/classes.c	2008-09-09 07:05:14 UTC (rev 4428)
@@ -65,3 +65,5 @@
 #include "nexuiz/dialog_singleplayer_winner.c"
 #include "nexuiz/dialog_credits.c"
 #include "nexuiz/credits.c"
+#include "nexuiz/dialog_multiplayer_playersetup_weapons.c"
+#include "nexuiz/weaponslist.c"

Modified: branches/nexuiz-2.0/data/qcsrc/menu/item/listbox.c
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/menu/item/listbox.c	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/menu/item/listbox.c	2008-09-09 07:05:14 UTC (rev 4428)
@@ -243,18 +243,21 @@
 	if(me.pressed == 2)
 		me.mouseDrag(me, me.dragScrollPos); // simulate mouseDrag event
 	me.updateControlTopBottom(me);
-	draw_VertButtonPicture(eX * (1 - me.controlWidth), strcat(me.src, "_s"), eX * me.controlWidth + eY, me.color2, 1);
-	if(me.nItems * me.itemHeight > 1)
+	if(me.controlWidth)
 	{
-		vector o, s;
-		o = eX * (1 - me.controlWidth) + eY * me.controlTop;
-		s = eX * me.controlWidth + eY * (me.controlBottom - me.controlTop);
-		if(me.pressed == 1)
-			draw_VertButtonPicture(o, strcat(me.src, "_c"), s, me.colorC, 1);
-		else if(me.focused)
-			draw_VertButtonPicture(o, strcat(me.src, "_f"), s, me.colorF, 1);
-		else
-			draw_VertButtonPicture(o, strcat(me.src, "_n"), s, me.color, 1);
+		draw_VertButtonPicture(eX * (1 - me.controlWidth), strcat(me.src, "_s"), eX * me.controlWidth + eY, me.color2, 1);
+		if(me.nItems * me.itemHeight > 1)
+		{
+			vector o, s;
+			o = eX * (1 - me.controlWidth) + eY * me.controlTop;
+			s = eX * me.controlWidth + eY * (me.controlBottom - me.controlTop);
+			if(me.pressed == 1)
+				draw_VertButtonPicture(o, strcat(me.src, "_c"), s, me.colorC, 1);
+			else if(me.focused)
+				draw_VertButtonPicture(o, strcat(me.src, "_f"), s, me.colorF, 1);
+			else
+				draw_VertButtonPicture(o, strcat(me.src, "_n"), s, me.color, 1);
+		}
 	}
 	draw_SetClip();
 	oldshift = draw_shift;

Modified: branches/nexuiz-2.0/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c	2008-09-09 07:05:14 UTC (rev 4428)
@@ -30,7 +30,7 @@
 }
 void fillNexuizPlayerSettingsTab(entity me)
 {
-	entity e, pms, sl;
+	entity e, pms, sl, e0;
 	float i, n;
 
 	me.TR(me);
@@ -78,7 +78,14 @@
 	me.TR(me);
 		me.TD(me, 1, 3, e = makeNexuizCheckBox(0, "cl_autoswitch", "Auto switch weapons on pickup"));
 	me.TR(me);
+		me.TD(me, 1, 1, e = makeNexuizButton("Weapon priority...", '0 0 0'));
+			e.onClick = DialogOpenButton_Click;
+			e.onClickEntity = main.weaponsDialog;
+		me.TD(me, 1, 2, e0 = makeNexuizTextLabel(0, string_null));
+			e0.textEntity = main.weaponsDialog;
+			e0.allowCut = 1;
 	me.TR(me);
+	me.TR(me);
 		me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Crosshair:"));
 		n = 11;
 		for(i = 1; i <= n; ++i)
@@ -125,7 +132,6 @@
 			e.addValue(e, "All", "0");
 			e.configureNexuizTextSliderValues(e);
 	me.TR(me);
-	me.TR(me);
 		me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Network speed:"));
 		me.TD(me, 1, 2, e = makeNexuizTextSlider("_cl_rate"));
 			e.addValue(e, "56k", "4000");
@@ -139,6 +145,6 @@
 		me.TD(me, 1, 0.64, e = makeNexuizInputBox(0, "cl_port"));
 
 	me.gotoRC(me, me.rows - 1, 0);
-		me.TD(me, 1, me.columns, makeNexuizCommandButton("Apply immediately", '0 0 0', "color -1 -1;name \"$_cl_name\";sendcvar cl_zoomfactor;sendcvar cl_zoomspeed;sendcvar cl_autoswitch;sendcvar cl_hidewaypoints;sendcvar cl_shownames;rate $_cl_rate", COMMANDBUTTON_APPLY));
+		me.TD(me, 1, me.columns, makeNexuizCommandButton("Apply immediately", '0 0 0', "color -1 -1;name \"$_cl_name\";sendcvar cl_weaponpriority;sendcvar cl_zoomfactor;sendcvar cl_zoomspeed;sendcvar cl_autoswitch;sendcvar cl_hidewaypoints;sendcvar cl_shownames;rate $_cl_rate", COMMANDBUTTON_APPLY));
 }
 #endif

Modified: branches/nexuiz-2.0/data/qcsrc/menu/nexuiz/mainwindow.c
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/menu/nexuiz/mainwindow.c	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/menu/nexuiz/mainwindow.c	2008-09-09 07:05:14 UTC (rev 4428)
@@ -2,6 +2,7 @@
 CLASS(MainWindow) EXTENDS(ModalController)
 	METHOD(MainWindow, configureMainWindow, void(entity))
 	ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
+	ATTRIB(MainWindow, weaponsDialog, entity, NULL)
 	ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
 	ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
 	ATTRIB(MainWindow, winnerDialog, entity, NULL)
@@ -43,6 +44,10 @@
 	i.configureDialog(i);
 	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+	me.weaponsDialog = i = spawnNexuizWeaponsDialog();
+	i.configureDialog(i);
+	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
 	n = spawnNexuizNexposee();
 	/*
 		if(checkextension("DP_GECKO_SUPPORT"))

Modified: branches/nexuiz-2.0/data/qcsrc/menu/skin-customizables.inc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/menu/skin-customizables.inc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/menu/skin-customizables.inc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -47,6 +47,7 @@
 	SKINVECTOR(COLOR_DIALOG_USERBIND, '0.7 0.7 1');
 	SKINVECTOR(COLOR_DIALOG_SINGLEPLAYER, '1 1 0.7');
 	SKINVECTOR(COLOR_DIALOG_CREDITS, '0.7 0.7 1');
+	SKINVECTOR(COLOR_DIALOG_WEAPONS, '1 0.7 0.7');
 
 	// nexposee positions of windows (they are the scale transformation
 	// centers, NOT the actual positions of the windows!)

Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_impulse.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_impulse.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_impulse.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -60,12 +60,16 @@
  * Impulse map:
  *
  * 0 reserved (no input)
- * 1 to 9: weapon shortcuts
- * 10: next weapon
+ * 1 to 9, 14: weapon shortcuts
+ * 10: next weapon according to linear list
  * 11: most recently used weapon
- * 12: previous weapon
- * 13: best weapon
+ * 12: previous weapon according to linear list
+ * 13: best weapon according to priority list
+ * 15: next weapon according to priority list
+ * 16: previous weapon according to priority list
  * 17: throw weapon
+ * 18: next weapon according to sbar_hudselector 1 list
+ * 19: previous weapon according to sbar_hudselector 1 list
  *
  * 30 to 39: create waypoints
  * 47: clear personal waypoints
@@ -116,20 +120,20 @@
 		else
 			self.impulse = imp; // retry in next frame
 	}
-	else if(imp >= 10 && imp <= 17)
+	else if(imp >= 10 && imp <= 19)
 	{
 		if(self.deadflag == DEAD_NO)
 		{
 			switch(imp)
 			{
 				case 10:
-					W_NextWeapon ();
+					W_NextWeapon (0);
 					break;
 				case 11:
 					W_SwitchWeapon (self.cnt); // previously used
 					break;
 				case 12:
-					W_PreviousWeapon ();
+					W_PreviousWeapon (0);
 					break;
 				case 13:
 					W_SwitchWeapon (w_getbestweapon(self));
@@ -137,10 +141,22 @@
 				case 14:
 					W_NextWeaponOnImpulse(0);
 					break;
+				case 15:
+					W_NextWeapon (2);
+					break;
+				case 16:
+					W_PreviousWeapon (2);
+					break;
 				case 17:
 					if (!g_minstagib)
 						W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750), '0 0 0', TRUE);
 					break;
+				case 18:
+					W_NextWeapon (1);
+					break;
+				case 19:
+					W_PreviousWeapon (1);
+					break;
 				}
 		}
 		else

Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_player.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_player.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_player.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -504,7 +504,6 @@
 			kh_Key_DropAll(self, FALSE);
 		else
 			kh_Key_DropAll(self, TRUE);
-		Portal_ClearAll(self);
 		if(self.flagcarried)
 			DropFlag(self.flagcarried);
 		// clear waypoints

Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_weapons.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_weapons.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_weapons.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -81,44 +81,30 @@
 }
 
 // next weapon
-void W_NextWeapon()
+void W_NextWeapon(float list)
 {
-	W_CycleWeapon(self.cvar_cl_weaponpriority, -1);
+	if(list == 0)
+		W_CycleWeapon(weaponpriority_hudselector_0, -1);
+	else if(list == 1)
+		W_CycleWeapon(weaponpriority_hudselector_1, -1);
+	else if(list == 2)
+		W_CycleWeapon(self.cvar_cl_weaponpriority, -1);
 }
 
 // prev weapon
-void W_PreviousWeapon()
+void W_PreviousWeapon(float list)
 {
-	W_CycleWeapon(self.cvar_cl_weaponpriority, +1);
+	if(list == 0)
+		W_CycleWeapon(weaponpriority_hudselector_0, +1);
+	else if(list == 1)
+		W_CycleWeapon(weaponpriority_hudselector_1, +1);
+	else if(list == 2)
+		W_CycleWeapon(self.cvar_cl_weaponpriority, +1);
 }
 
 string W_FixWeaponOrder(string order, float complete)
 {
-	string neworder;
-	float i, n, w;
-
-	n = tokenize(order);
-	for(i = 0; i < n; ++i)
-	{
-		w = stof(argv(i));
-		if(w >= WEP_FIRST && w <= WEP_LAST && w == floor(w))
-			neworder = strcat(neworder, ftos(w), " ");
-	}
-
-	if(complete)
-	{
-		n = tokenize(neworder);
-		for(w = WEP_LAST; w >= WEP_FIRST; --w)
-		{
-			for(i = 0; i < n; ++i)
-				if(stof(argv(i)) == w)
-					break;
-			if(i == n) // not found
-				neworder = strcat(neworder, ftos(w), " ");
-		}
-	}
-	
-	return substring(neworder, 0, strlen(neworder) - 1);
+	return fixPriorityList(order, WEP_FIRST, WEP_LAST, complete);
 }
 
 string W_FixWeaponOrder_AllowIncomplete(string order)
@@ -452,7 +438,6 @@
 
 void RegisterWeapons()
 {
-	register_dummy_weapon();
 	// %weaponaddpoint
 	register_weapon(WEP_LASER,            w_laser,     0,              1, 1,     0, "laser",     "laser",           "Laser");
 	register_weapon(WEP_SHOTGUN,          w_shotgun,   IT_SHELLS,      2, 1,  2500, "shotgun",   "shotgun",         "Shotgun");
@@ -465,4 +450,5 @@
 	register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher, IT_ROCKETS,     9, 1, 10000, "rl",        "rocketlauncher",  "Rocket Launcher");
 	register_weapon(WEP_PORTO,            w_porto,     IT_SUPERWEAPON, 0, 0,     0, "porto" ,    "porto",           "Port-O-Launch");
 	register_weapon(WEP_MINSTANEX,        w_minstanex, IT_CELLS,       7, 0, 10000, "minstanex", "minstanex",       "MinstaNex");
+	register_weapons_done();
 }

Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -588,6 +588,9 @@
 entity weapon_info[24];
 entity dummy_weapon_info;
 .float(float) weapon_func;
+string weaponpriority_hudselector_0;
+string weaponpriority_hudselector_1;
+
 void register_weapon(float id, float(float) func, float ammotype, float i, float normalweapon, float pickupbasevalue, string modelname, string shortname, string name)
 {
 	entity e;
@@ -609,7 +612,7 @@
 {
 	return 0;
 }
-void register_dummy_weapon()
+void register_weapons_done()
 {
 	dummy_weapon_info = spawn();
 	dummy_weapon_info.classname = "weapon_info";
@@ -623,6 +626,25 @@
 	dummy_weapon_info.spawnflags = 0;
 	dummy_weapon_info.impulse = -1;
 	dummy_weapon_info.bot_pickupbasevalue = 0;
+
+	float i;
+	weaponpriority_hudselector_0 = "";
+	for(i = 24; i >= 1; --i)
+		if(weapon_info[i-1])
+			weaponpriority_hudselector_0 = strcat(weaponpriority_hudselector_0, " ", ftos(i));
+
+	float imp;
+	weaponpriority_hudselector_1 = "";
+	for(i = 1; i <= 24; ++i)
+		if(weapon_info[i-1] && weapon_info[i-1].impulse == 0)
+			weaponpriority_hudselector_1 = strcat(weaponpriority_hudselector_1, " ", ftos(i));
+	for(imp = 9; imp > 0; --imp)
+		for(i = 1; i <= 24; ++i)
+			if(weapon_info[i-1] && weapon_info[i-1].impulse == imp)
+				weaponpriority_hudselector_1 = strcat(weaponpriority_hudselector_1, " ", ftos(i));
+
+	weaponpriority_hudselector_0 = strzone(substring(weaponpriority_hudselector_0, 1, strlen(weaponpriority_hudselector_0) - 1));
+	weaponpriority_hudselector_1 = strzone(substring(weaponpriority_hudselector_1, 1, strlen(weaponpriority_hudselector_1) - 1));
 }
 entity get_weaponinfo(float id)
 {

Modified: branches/nexuiz-2.0/data/qcsrc/server/defs.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/defs.qh	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/defs.qh	2008-09-09 07:05:14 UTC (rev 4428)
@@ -489,3 +489,5 @@
 .float stat_sys_ticrate;
 .float phase;
 .float weapons;
+
+.float porto_forbidden;

Modified: branches/nexuiz-2.0/data/qcsrc/server/portals.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/portals.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/portals.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -437,7 +437,7 @@
 	if(!self.enemy)
 		error("Portal_Think called for a broken portal\n");
 
-	print("Portal ID ", etos(self), " verified working.\n");
+	//print("Portal ID ", etos(self), " verified working.\n");
 	portals_must_not_break = 1;
 
 	o = self.owner;

Modified: branches/nexuiz-2.0/data/qcsrc/server/race.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/race.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/race.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -344,6 +344,8 @@
 		self = oldself;
 	}
 
+	other.porto_forbidden = 2; // decreased by 1 each StartFrame
+
 	if(other.race_checkpoint == -1 || other.race_checkpoint == self.race_checkpoint)
 	{
 		/*

Modified: branches/nexuiz-2.0/data/qcsrc/server/sv_main.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/sv_main.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/sv_main.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -177,4 +177,7 @@
 		self = RandomSelection_chosen_ent;
 		SelectSpawnPoint(0);
 	}
+
+	FOR_EACH_PLAYER(self)
+		self.porto_forbidden = max(0, self.porto_forbidden - 1);
 }

Modified: branches/nexuiz-2.0/data/qcsrc/server/w_porto.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/w_porto.qc	2008-09-09 06:53:16 UTC (rev 4427)
+++ branches/nexuiz-2.0/data/qcsrc/server/w_porto.qc	2008-09-09 07:05:14 UTC (rev 4428)
@@ -212,6 +212,7 @@
 
 		if (self.BUTTON_ATCK)
 		if (!self.porto_current)
+		if (!self.porto_forbidden)
 		if (weapon_prepareattack(0, cvar("g_balance_porto_primary_refire")))
 		{
 			W_Porto_Attack();




More information about the nexuiz-commits mailing list