r4803 - in trunk/data/qcsrc: client common server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Oct 22 04:59:28 EDT 2008
Author: div0
Date: 2008-10-22 04:59:18 -0400 (Wed, 22 Oct 2008)
New Revision: 4803
Modified:
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/teamradar.qc
trunk/data/qcsrc/common/constants.qh
trunk/data/qcsrc/server/mode_onslaught.qc
Log:
more stuff in the team radar
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2008-10-22 08:14:49 UTC (rev 4802)
+++ trunk/data/qcsrc/client/Main.qc 2008-10-22 08:59:18 UTC (rev 4803)
@@ -466,6 +466,7 @@
// CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
// The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
+void Ent_RadarLink();
void(float bIsNewEntity) CSQC_Ent_Update =
{
float t;
@@ -495,6 +496,8 @@
Ent_Nagger();
else if(self.enttype == ENT_CLIENT_WAYPOINT)
Ent_WaypointSprite();
+ else if(self.enttype == ENT_CLIENT_RADARLINK)
+ Ent_RadarLink();
else
error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
Modified: trunk/data/qcsrc/client/teamradar.qc
===================================================================
--- trunk/data/qcsrc/client/teamradar.qc 2008-10-22 08:14:49 UTC (rev 4802)
+++ trunk/data/qcsrc/client/teamradar.qc 2008-10-22 08:59:18 UTC (rev 4803)
@@ -119,6 +119,32 @@
}
}
+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));
+ end = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(end));
+ norm = normalize(start - end);
+ norm_z = norm_x;
+ norm_x = -norm_y;
+ norm_y = norm_z;
+ norm_z = 0;
+
+ c0 = colormapPaletteColor(colors & 0x0F, FALSE);
+ c1 = colormapPaletteColor((colors & 0xF0) / 0x10, FALSE);
+
+ R_BeginPolygon("", 0);
+ R_PolygonVertex(start - norm, '0 0 0', c0, 1);
+ R_PolygonVertex(start + norm, '0 1 0', c0, 1);
+ R_PolygonVertex(end + norm, '1 1 0', c1, 1);
+ R_PolygonVertex(end - norm, '1 0 0', c1, 1);
+ R_EndPolygon();
+
+ print("p\n");
+}
+
float cl_teamradar_scale;
float cl_teamradar_background_alpha;
float cl_teamradar_foreground_alpha;
@@ -241,6 +267,8 @@
);
draw_teamradar_background(cl_teamradar_background_alpha, cl_teamradar_foreground_alpha);
+ 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)); )
draw_teamradar_icon(tm.origin, tm.teamradar_icon, tm.teamradar_time, tm.teamradar_color, tm.alpha);
for(tm = world; (tm = find(tm, classname, "entcs_receiver")); )
@@ -253,3 +281,39 @@
drawresetcliparea();
};
+
+
+
+// radar links
+
+void Ent_RadarLink()
+{
+ float sendflags, f;
+ sendflags = ReadByte();
+
+ InterpolateOrigin_Undo();
+
+ self.iflags = IFLAG_VELOCITY;
+ self.classname = "radarlink";
+
+ if(sendflags & 1)
+ {
+ self.origin_x = ReadCoord();
+ self.origin_y = ReadCoord();
+ self.origin_z = ReadCoord();
+ }
+
+ if(sendflags & 2)
+ {
+ self.velocity_x = ReadCoord();
+ self.velocity_y = ReadCoord();
+ self.velocity_z = ReadCoord();
+ }
+
+ if(sendflags & 4)
+ {
+ self.team = ReadByte();
+ }
+
+ InterpolateOrigin_Note();
+}
Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh 2008-10-22 08:14:49 UTC (rev 4802)
+++ trunk/data/qcsrc/common/constants.qh 2008-10-22 08:59:18 UTC (rev 4803)
@@ -52,18 +52,19 @@
const float ENT_CLIENT_LASER = 8;
const float ENT_CLIENT_NAGGER = 9; // flags [votecalledvote]
const float ENT_CLIENT_WAYPOINT = 10; // flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable]
+const float ENT_CLIENT_RADARLINK = 11; // flags [startorigin] [endorigin] [startcolor+16*endcolor]
- const float SPRITERULE_DEFAULT = 0;
- const float SPRITERULE_TEAMPLAY = 1;
+const float SPRITERULE_DEFAULT = 0;
+const float SPRITERULE_TEAMPLAY = 1;
- const float RADARICON_FLAG = 1;
- const float RADARICON_FLAGCARRIER = 1;
- const float RADARICON_HERE = 1; // TODO make these 3 and 4, and make images for them
- const float RADARICON_DANGER = 1;
- const float RADARICON_WAYPOINT = 1;
- const float RADARICON_HELPME = 1;
- const float RADARICON_CONTROLPOINT = 1;
- const float RADARICON_GENERATOR = 1;
+const float RADARICON_FLAG = 1;
+const float RADARICON_FLAGCARRIER = 1;
+const float RADARICON_HERE = 1; // TODO make these 3 and 4, and make images for them
+const float RADARICON_DANGER = 1;
+const float RADARICON_WAYPOINT = 1;
+const float RADARICON_HELPME = 1;
+const float RADARICON_CONTROLPOINT = 1;
+const float RADARICON_GENERATOR = 1;
///////////////////////////
// key constants
Modified: trunk/data/qcsrc/server/mode_onslaught.qc
===================================================================
--- trunk/data/qcsrc/server/mode_onslaught.qc 2008-10-22 08:14:49 UTC (rev 4802)
+++ trunk/data/qcsrc/server/mode_onslaught.qc 2008-10-22 08:59:18 UTC (rev 4803)
@@ -1,5 +1,6 @@
void onslaught_generator_updatesprite(entity e);
void onslaught_controlpoint_updatesprite(entity e);
+void onslaught_link_checkupdate();
.entity sprite;
.string target2;
@@ -839,6 +840,71 @@
SUB_UseTargets(); // to reset the structures, playerspawns etc.
}
+float onslaught_link_send(entity to, float sendflags)
+{
+ WriteByte(MSG_ENTITY, ENT_CLIENT_RADARLINK);
+ WriteByte(MSG_ENTITY, sendflags);
+ if(sendflags & 1)
+ {
+ WriteCoord(MSG_ENTITY, self.goalentity.origin_x);
+ WriteCoord(MSG_ENTITY, self.goalentity.origin_y);
+ WriteCoord(MSG_ENTITY, self.goalentity.origin_z);
+ }
+ if(sendflags & 2)
+ {
+ WriteCoord(MSG_ENTITY, self.enemy.origin_x);
+ WriteCoord(MSG_ENTITY, self.enemy.origin_y);
+ WriteCoord(MSG_ENTITY, self.enemy.origin_z);
+ }
+ if(sendflags & 4)
+ {
+ WriteByte(MSG_ENTITY, self.clientcolors); // which is goalentity's color + enemy's color * 16
+ }
+ return TRUE;
+}
+
+void onslaught_link_checkupdate()
+{
+ // TODO check if the two sides have moved (currently they won't move anyway)
+ float redpower, bluepower;
+
+ redpower = bluepower = 0;
+ if(self.goalentity.islinked)
+ {
+ if(self.goalentity.team == COLOR_TEAM1)
+ redpower = 1;
+ else if(self.goalentity.team == COLOR_TEAM2)
+ bluepower = 1;
+ }
+ if(self.enemy.islinked)
+ {
+ if(self.enemy.team == COLOR_TEAM1)
+ redpower = 2;
+ else if(self.enemy.team == COLOR_TEAM2)
+ bluepower = 2;
+ }
+
+ float cc;
+ if(redpower == 1 && bluepower == 2)
+ cc = (COLOR_TEAM1 - 1) * 0x01 + (COLOR_TEAM2 - 1) * 0x10;
+ else if(redpower == 2 && bluepower == 1)
+ cc = (COLOR_TEAM1 - 1) * 0x10 + (COLOR_TEAM2 - 1) * 0x01;
+ else if(redpower)
+ cc = (COLOR_TEAM1 - 1) * 0x11;
+ else if(bluepower)
+ cc = (COLOR_TEAM2 - 1) * 0x11;
+ else
+ cc = 0;
+
+ if(cc != self.clientcolors)
+ {
+ self.clientcolors = cc;
+ self.SendFlags |= 4;
+ }
+
+ self.nextthink = time;
+}
+
void onslaught_link_delayed()
{
self.goalentity = find(world, targetname, self.target);
@@ -848,6 +914,10 @@
if (!self.enemy)
objerror("can not find target2\n");
dprint(etos(self.goalentity), " linked with ", etos(self.enemy), "\n");
+
+ self.SendFlags |= 3;
+ self.think = onslaught_link_checkupdate;
+ self.nextthink = time;
}
/*QUAKED spawnfunc_onslaught_link (0 .5 .8) (-16 -16 -16) (16 16 16)
@@ -870,4 +940,6 @@
objerror("target and target2 must be set\n");
self.think = onslaught_link_delayed;
self.nextthink = time + 0.1;
+ self.SendEntity = onslaught_link_send;
+ Net_LinkEntity(self);
};
More information about the nexuiz-commits
mailing list