r4805 - in trunk/data/qcsrc: client common server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Oct 22 07:24:34 EDT 2008
Author: div0
Date: 2008-10-22 07:24:34 -0400 (Wed, 22 Oct 2008)
New Revision: 4805
Removed:
trunk/data/qcsrc/client/ons.qc
Modified:
trunk/data/qcsrc/client/Defs.qc
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/View.qc
trunk/data/qcsrc/client/hook.qc
trunk/data/qcsrc/client/progs.src
trunk/data/qcsrc/client/teamradar.qc
trunk/data/qcsrc/common/constants.qh
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/g_hook.qc
trunk/data/qcsrc/server/g_hook.qh
trunk/data/qcsrc/server/g_world.qc
Log:
- experimental CSQC change: get rid of old ONS team radar code, support ons_showmap using the new radar by changing its parameters when M key is used
- send preferred hook shot origin over the net to csqc to support both onhand and offhand hook
Modified: trunk/data/qcsrc/client/Defs.qc
===================================================================
--- trunk/data/qcsrc/client/Defs.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/client/Defs.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -208,3 +208,4 @@
// database for misc stuff
float tempdb;
+vector hook_shotorigin;
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/client/Main.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -287,7 +287,7 @@
button_attack2 = 0;
return false;
} else if(strCmd == "ons_map") {
- Cmd_ons_map();
+ ons_showmap = !ons_showmap;
return true;
} else if(strCmd == "sbar_columns_set") {
Cmd_Sbar_SetFields(argc);
@@ -640,6 +640,9 @@
maxclients = ReadByte();
for(i = 0; i < 24; ++i)
weaponimpulse[i] = ReadByte() - 1;
+ hook_shotorigin_x = ReadCoord();
+ hook_shotorigin_y = ReadCoord();
+ hook_shotorigin_z = ReadCoord();
CSQC_CheckRevision();
}
Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/client/View.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -339,26 +339,11 @@
self = e;
// draw radar
- if(gametype == GAME_ONSLAUGHT)
+ if(teamplay)
{
- if(cvar("cl_teamradar") >= 2)
- {
- if(!scoreboard_active)
- teamradar_view();
- }
- else
- ons_view();
- //drawstring('0 0', minimapname, '8 8 0', '1 1 1', 1, 0);
- //drawsetcliparea(0,0,800,600);
- //drawresetcliparea();
+ if((cvar_string("cl_teamradar") != "0" && !scoreboard_active) || ons_showmap)
+ teamradar_view();
}
- else if(teamplay)
- {
- //if(cvar("cl_teamradar") >= 1) // TODO change it back to this
- if(cvar_string("cl_teamradar") != "0") // (so it is on by default)
- if(!scoreboard_active)
- teamradar_view();
- }
// draw sbar
if(cvar("r_letterbox") == 0)
Modified: trunk/data/qcsrc/client/hook.qc
===================================================================
--- trunk/data/qcsrc/client/hook.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/client/hook.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -38,7 +38,7 @@
if(time >= self.HookKillTime)
return;
if(self.sv_entnum == player_localentnum - 1)
- a = view_origin + view_forward * 8 - view_right * 8 + view_up * -12;
+ a = view_origin + view_forward * hook_shotorigin_x + view_right * hook_shotorigin_y + view_up * hook_shotorigin_z;
else
a = self.HookStart;
b = self.HookEnd;
Deleted: trunk/data/qcsrc/client/ons.qc
===================================================================
--- trunk/data/qcsrc/client/ons.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/client/ons.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -1,61 +0,0 @@
-void() Cmd_ons_map =
-{
- ons_showmap = !ons_showmap;
-};
-
-vector(vector coord) mapcoords =
-{
- local vector ret;
- ret = coord; // put that up to ret's definition and it's '0 0 0' ... stupid fteqcc
- ret -= mi_center;
- ret_x = ret_x * 256.0 / mi_scale_x;
- ret_y = -ret_y * 256.0 / mi_scale_y;
- ret_z = 0;
- ret = ret + '400 178 0';
- return ret;
-};
-
-void(vector coord, vector pangles, vector rgb) drawplayer =
-{
- makevectors(pangles);
- v_forward_z = 0;
- v_forward = normalize(v_forward);
- v_forward_y *= -1.0;
- v_right_x = -v_forward_y;
- v_right_y = v_forward_x;
- // Ryling on !tex[0] => texture_white
- // beware of the order, it has to be clockwise!
- R_BeginPolygon("", 0);
- R_PolygonVertex(coord+v_forward*2, '0 0 0', rgb, 1);
- R_PolygonVertex(coord+v_right*3-v_forward*2, '0 1 0', rgb, 1);
- R_PolygonVertex(coord-v_forward, '1 0 0', rgb, 1);
- R_PolygonVertex(coord-v_right*3-v_forward*2, '1 1 0', rgb, 1);
- R_EndPolygon();
-};
-
-void() ons_view =
-{
- if(ons_showmap) {
- local float color;
- local vector coord, rgb;
-
- color = GetPlayerColor(player_localentnum-1);
- rgb = GetTeamRGB(color);
-
- coord = mapcoords(pmove_org);
-
- drawpic('272 50 0', minimapname, '256 256 0', '1 1 1', 1, 0);
- drawpic('257 35 0', "gfx/ons-frame.tga", '286 286 0', '1 1 1', 1, 0);
- drawpic('257 35 0', "gfx/ons-frame-team.tga", '286 286 0', rgb, 1, 0);
-
- drawplayer(coord, input_angles, '1 1 1');
-
- local entity tm;
- for(tm = world; (tm = find(tm, classname, "entcs_receiver")); )
- if(GetPlayerColor(tm.sv_entnum) == color)
- {
- //print(strcat("GPS: ", ftos(tm.sv_entnum), " - ", vtos(tm.origin), "\n"));
- drawplayer(mapcoords(tm.origin), tm.angles, rgb);
- }
- }
-};
Modified: trunk/data/qcsrc/client/progs.src
===================================================================
--- trunk/data/qcsrc/client/progs.src 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/client/progs.src 2008-10-22 11:24:34 UTC (rev 4805)
@@ -19,7 +19,6 @@
miscfunctions.qc
teamplay.qc
-ons.qc
ctf.qc
sbar.qc
Modified: trunk/data/qcsrc/client/teamradar.qc
===================================================================
--- trunk/data/qcsrc/client/teamradar.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/client/teamradar.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -121,7 +121,6 @@
void draw_teamradar_link(vector start, vector end, float colors)
{
- float dt;
vector c0, c1, norm;
start = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(start));
@@ -153,24 +152,39 @@
void teamradar_loadcvars()
{
- cl_teamradar_scale = cvar("cl_teamradar_scale");
- cl_teamradar_background_alpha = cvar("cl_teamradar_background_alpha");
- cl_teamradar_foreground_alpha = cvar("cl_teamradar_foreground_alpha");
- cl_teamradar_rotation = cvar("cl_teamradar_rotation");
- cl_teamradar_size = stov(cvar_string("cl_teamradar_size"));
- cl_teamradar_position = stov(cvar_string("cl_teamradar_position"));
- cl_teamradar_zoommode = cvar("cl_teamradar_zoommode");
+ if(ons_showmap)
+ {
+ cl_teamradar_scale = 42; // dummy, not used (see zoommode)
+ cl_teamradar_background_alpha = 1;
+ cl_teamradar_foreground_alpha = 1;
+ cl_teamradar_rotation = cvar("cl_teamradar_rotation");
+ if(!cl_teamradar_rotation)
+ cl_teamradar_rotation = 4;
+ cl_teamradar_size = '256 256 0'; // TODO make somewhat variable?
+ cl_teamradar_position = '0.5 0.5 0';
+ cl_teamradar_zoommode = 3;
+ }
+ else
+ {
+ cl_teamradar_scale = cvar("cl_teamradar_scale");
+ cl_teamradar_background_alpha = cvar("cl_teamradar_background_alpha");
+ cl_teamradar_foreground_alpha = cvar("cl_teamradar_foreground_alpha");
+ cl_teamradar_rotation = cvar("cl_teamradar_rotation");
+ cl_teamradar_size = stov(cvar_string("cl_teamradar_size"));
+ cl_teamradar_position = stov(cvar_string("cl_teamradar_position"));
+ cl_teamradar_zoommode = cvar("cl_teamradar_zoommode");
- // others default to 0
- // match this to defaultNexuiz.cfg!
- if(!cl_teamradar_scale) cl_teamradar_scale = 4096;
- if(!cl_teamradar_background_alpha) cl_teamradar_background_alpha = 0.4;
- if(!cl_teamradar_foreground_alpha) cl_teamradar_foreground_alpha = 0.8;
- if(!cl_teamradar_size_x) cl_teamradar_size_x = 128;
- if(!cl_teamradar_size_y) cl_teamradar_size_y = cl_teamradar_size_x;
+ // others default to 0
+ // match this to defaultNexuiz.cfg!
+ if(!cl_teamradar_scale) cl_teamradar_scale = 4096;
+ if(!cl_teamradar_background_alpha) cl_teamradar_background_alpha = 0.4;
+ if(!cl_teamradar_foreground_alpha) cl_teamradar_foreground_alpha = 0.8;
+ if(!cl_teamradar_size_x) cl_teamradar_size_x = 128;
+ if(!cl_teamradar_size_y) cl_teamradar_size_y = cl_teamradar_size_x;
- cl_teamradar_size_z = 0;
- cl_teamradar_position_z = 0;
+ cl_teamradar_size_z = 0;
+ cl_teamradar_position_z = 0;
+ }
}
void() teamradar_view =
@@ -265,6 +279,29 @@
);
draw_teamradar_background(cl_teamradar_background_alpha, cl_teamradar_foreground_alpha);
+
+ if(ons_showmap)
+ {
+ drawresetcliparea();
+
+ vector frame_origin, frame_size;
+ frame_origin = frame_size = '0 0 0';
+
+ frame_origin_x = teamradar_origin2d_x - teamradar_size2d_x * 0.55859375;
+ frame_origin_y = teamradar_origin2d_y - teamradar_size2d_y * 0.55859375;
+ frame_size_x = teamradar_size2d_x * 1.1171875;
+ frame_size_y = teamradar_size2d_y * 1.1171875;
+ drawpic(frame_origin, "gfx/ons-frame.tga", frame_size, '1 1 1', 1, 0);
+ drawpic(frame_origin, "gfx/ons-frame-team.tga", frame_size, rgb, 1, 0);
+
+ drawsetcliparea(
+ teamradar_origin2d_x - teamradar_size2d_x * 0.5,
+ teamradar_origin2d_y - teamradar_size2d_y * 0.5,
+ teamradar_size2d_x,
+ teamradar_size2d_y
+ );
+ }
+
for(tm = world; (tm = find(tm, classname, "radarlink")); )
draw_teamradar_link(tm.origin, tm.velocity, tm.team);
for(tm = world; (tm = findflags(tm, teamradar_icon, 0xFFFFFF)); )
@@ -286,7 +323,7 @@
void Ent_RadarLink()
{
- float sendflags, f;
+ float sendflags;
sendflags = ReadByte();
InterpolateOrigin_Undo();
Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/common/constants.qh 2008-10-22 11:24:34 UTC (rev 4805)
@@ -20,7 +20,8 @@
// Revision 19: fog
// Revision 20: naggers
// Revision 21: entcs for players optimized (position data down from 12 to 7 bytes); waypointsprites in csqc for team radar
-#define CSQC_REVISION 21
+// Revision 22: hook shot origin
+#define CSQC_REVISION 22
// probably put these in common/
// so server/ and client/ can be synced better
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/server/cl_client.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -807,6 +807,9 @@
WriteByte(MSG_ONE, maxclients);
for(i = 1; i <= 24; ++i)
WriteByte(MSG_ONE, (get_weaponinfo(i)).impulse + 1);
+ WriteCoord(MSG_ONE, hook_shotorigin_x);
+ WriteCoord(MSG_ONE, hook_shotorigin_y);
+ WriteCoord(MSG_ONE, hook_shotorigin_z);
}
/*
Modified: trunk/data/qcsrc/server/g_hook.qc
===================================================================
--- trunk/data/qcsrc/server/g_hook.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/server/g_hook.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -130,7 +130,7 @@
self.nextthink = time;
makevectors(self.owner.v_angle);
- org = self.owner.origin + self.owner.view_ofs + v_forward * 8 - v_right * 8 + v_up * -12;
+ org = self.owner.origin + self.owner.view_ofs + v_forward * hook_shotorigin_x + v_right * hook_shotorigin_y + v_up * hook_shotorigin_z;
#if 0
tracebox(org, self.mins, self.maxs, self.origin, MOVE_NOMONSTERS, self.owner);
@@ -250,8 +250,6 @@
self.owner.flags (-) FL_ONGROUND;
}
-
- org = org + dir*50; // get the beam out of the player's eyes
}
makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0');
@@ -464,6 +462,14 @@
// note: The hook entity does the actual pulling
}
+void GrappleHookInit()
+{
+ if(g_grappling_hook)
+ hook_shotorigin = '8 -8 -12';
+ else
+ hook_shotorigin = '25 6 -8';
+}
+
void SetGrappleHookBindings()
{
// this function has been modified for Nexuiz
Modified: trunk/data/qcsrc/server/g_hook.qh
===================================================================
--- trunk/data/qcsrc/server/g_hook.qh 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/server/g_hook.qh 2008-10-22 11:24:34 UTC (rev 4805)
@@ -12,3 +12,6 @@
float HOOK_RELEASING = 8;
float HOOK_WAITING_FOR_RELEASE = 16;
.float hook_state;
+
+void GrappleHookInit();
+vector hook_shotorigin;
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2008-10-22 09:02:18 UTC (rev 4804)
+++ trunk/data/qcsrc/server/g_world.qc 2008-10-22 11:24:34 UTC (rev 4805)
@@ -289,6 +289,7 @@
InitGameplayMode();
readlevelcvars();
+ GrappleHookInit();
player_count = 0;
bot_waypoints_for_items = cvar("g_waypoints_for_items");
More information about the nexuiz-commits
mailing list