r5734 - in trunk/data: . qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Feb 4 03:16:33 EST 2009


Author: div0
Date: 2009-02-04 03:16:29 -0500 (Wed, 04 Feb 2009)
New Revision: 5734

Added:
   trunk/data/shotorigin_adjuster.cfg
Modified:
   trunk/data/qcsrc/client/Main.qc
Log:
exec shotorigin_adjuster.cfg - graphical shot origin editor


Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc	2009-02-04 07:48:57 UTC (rev 5733)
+++ trunk/data/qcsrc/client/Main.qc	2009-02-04 08:16:29 UTC (rev 5734)
@@ -355,6 +355,28 @@
 	return false;
 }
 
+.vector view_ofs;
+entity debug_shotorg;
+void ShotOrg_Draw()
+{
+	self.origin = view_origin + view_forward * self.view_ofs_x + view_right * self.view_ofs_y + view_up * self.view_ofs_z;
+	self.angles = view_angles;
+	self.angles_x = -self.angles_x;
+	R_AddEntity(self);
+}
+
+void ShotOrg_Spawn()
+{
+	debug_shotorg = spawn();
+	debug_shotorg.draw = ShotOrg_Draw;
+	debug_shotorg.renderflags = RF_VIEWMODEL;
+	debug_shotorg.effects = EF_FULLBRIGHT;
+	precache_model("models/ax_planes.md3");
+	setmodel(debug_shotorg, "models/ax_planes.md3");
+	debug_shotorg.scale = 4;
+	debug_shotorg.view_ofs = '25 8 -8';
+}
+
 void GameCommand(string msg)
 {
 	float argc;
@@ -398,6 +420,42 @@
 		blurtest_power = stof(argv(3));
 	}
 #endif
+	else if(cmd == "shotorg_move") {
+		if(!debug_shotorg)
+			ShotOrg_Spawn();
+		else
+			debug_shotorg.view_ofs = debug_shotorg.view_ofs + stov(argv(1));
+		print(vtos(debug_shotorg.view_ofs), "\n");
+	}
+	else if(cmd == "shotorg_movez") {
+		if(!debug_shotorg)
+			ShotOrg_Spawn();
+		else
+			debug_shotorg.view_ofs = debug_shotorg.view_ofs + stof(argv(1)) * (debug_shotorg.view_ofs * (1 / debug_shotorg.view_ofs_x)); // closer/farther, same xy pos
+		print(vtos(debug_shotorg.view_ofs), "\n");
+	}
+	else if(cmd == "shotorg_set") {
+		if(!debug_shotorg)
+			ShotOrg_Spawn();
+		else
+			debug_shotorg.view_ofs = stov(argv(1));
+		print(vtos(debug_shotorg.view_ofs), "\n");
+	}
+	else if(cmd == "shotorg_setz") {
+		if(!debug_shotorg)
+			ShotOrg_Spawn();
+		else
+			debug_shotorg.view_ofs = debug_shotorg.view_ofs * (stof(argv(1)) / debug_shotorg.view_ofs_x); // closer/farther, same xy pos
+		print(vtos(debug_shotorg.view_ofs), "\n");
+	}
+	else if(cmd == "shotorg_end") {
+		if(debug_shotorg)
+		{
+			print(vtos(debug_shotorg.view_ofs), "\n");
+			remove(debug_shotorg);
+			debug_shotorg = world;
+		}
+	}
 	else
 	{
 		print("Invalid command. For a list of supported commands, try cl_cmd help.\n");

Added: trunk/data/shotorigin_adjuster.cfg
===================================================================
--- trunk/data/shotorigin_adjuster.cfg	                        (rev 0)
+++ trunk/data/shotorigin_adjuster.cfg	2009-02-04 08:16:29 UTC (rev 5734)
@@ -0,0 +1,21 @@
+echo "Use HOME, DEL, END, PGDN like arrow keys to move the shot origin."
+echo "Move the shot origin forward/backward using INS and PGUP keys."
+echo "Move the shot origin forward/backward without changing its position in the view using NUM + and - keys."
+echo "Move it to the default shot origin using the NUM * key."
+echo "Write it down and press NUM / when done."
+
+cl_cmd shotorg_move "0 0 0" // init
+
+bind HOME "cl_cmd shotorg_move \"0 0 0.5\""
+bind DEL "cl_cmd shotorg_move \"0 -0.5 0\""
+bind END "cl_cmd shotorg_move \"0 0 -0.5\""
+bind PGDN "cl_cmd shotorg_move \"0 0.5 0\""
+
+bind INS "cl_cmd shotorg_move \"-1 0 0\""
+bind PGUP "cl_cmd shotorg_move \"1 0 0\""
+
+bind KP_PLUS "cl_cmd shotorg_movez 1"
+bind KP_MINUS "cl_cmd shotorg_movez -1"
+bind KP_MULTIPLY "cl_cmd shotorg_set \"25 8 -8\""
+
+bind KP_DIVIDE "cl_cmd shotorg_end"




More information about the nexuiz-commits mailing list