r5687 - in trunk/data: . qcsrc/client qcsrc/common qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jan 28 13:29:32 EST 2009
Author: div0
Date: 2009-01-28 13:29:31 -0500 (Wed, 28 Jan 2009)
New Revision: 5687
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/client/Defs.qc
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/View.qc
trunk/data/qcsrc/client/main.qh
trunk/data/qcsrc/client/mapvoting.qc
trunk/data/qcsrc/common/constants.qh
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/defs.qh
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/race.qc
trunk/data/qcsrc/server/w_porto.qc
Log:
remove all TEs that contain a permanent state.
This way, savegames should contain all necessary info now.
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/defaultNexuiz.cfg 2009-01-28 18:29:31 UTC (rev 5687)
@@ -970,7 +970,6 @@
seta g_maplist_votable_nodetail 1 "nodetail only shows total count instead of all vote counts per map, so votes don't influence others that much"
seta g_maplist_votable_abstain 0 "when 1, you can abstain from your vote"
seta g_maplist_votable_screenshot_dir "maps" "where to look for map screenshots"
-seta g_maplist_textonly 0 "use old style centerprint"
alias suggestmap "cmd suggestmap $1"
set g_chat_flood_spl 3 "normal chat: seconds between lines to not count as flooding"
Modified: trunk/data/qcsrc/client/Defs.qc
===================================================================
--- trunk/data/qcsrc/client/Defs.qc 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/client/Defs.qc 2009-01-28 18:29:31 UTC (rev 5687)
@@ -174,7 +174,6 @@
.float team_size;
float vid_conwidth, vid_conheight;
-float configdb;
float binddb;
// QUALIFYING
@@ -221,3 +220,7 @@
.float damageforcescale;
.void(float thisdmg, float hittype, vector org, vector thisforce) event_damage;
+
+// only for Porto
+float angles_held_status;
+vector angles_held;
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/client/Main.qc 2009-01-28 18:29:31 UTC (rev 5687)
@@ -41,16 +41,6 @@
float __engine_check;
#endif
-string config_get(string key, string defaultvalue)
-{
- string s;
- s = db_get(configdb, strcat("/s/", key));
- if(s == "")
- return defaultvalue;
- else
- return db_get(configdb, strcat("/v/", key));
-}
-
string forcefog;
void WaypointSprite_Load();
void CSQC_Init(void)
@@ -71,7 +61,6 @@
CSQC_CheckEngine();
dprint_load();
- configdb = db_create();
binddb = db_create();
tempdb = db_create();
compressShortVector_init();
@@ -170,7 +159,6 @@
remove(teams);
remove(players);
- db_close(configdb);
db_close(binddb);
db_close(tempdb);
@@ -478,6 +466,47 @@
Sbar_UpdateTeamPos(o);
}
+void Net_Reset()
+{
+}
+
+void Ent_ClientData()
+{
+ float f;
+ float newspectatee_status;
+
+ f = ReadByte();
+
+ sb_showscores_force = (f & 1);
+
+ if(f & 2)
+ {
+ newspectatee_status = ReadByte();
+ if(newspectatee_status == player_localentnum)
+ newspectatee_status = -1; // observing
+ }
+ else
+ newspectatee_status = 0;
+
+ spectatorbutton_zoom = (f & 4);
+
+ if(f & 8)
+ {
+ angles_held_status = 1;
+ angles_held_x = ReadAngle();
+ angles_held_y = ReadAngle();
+ angles_held_z = 0;
+ }
+
+ if(newspectatee_status != spectatee_status)
+ {
+ // clear race stuff
+ race_laptime = 0;
+ race_checkpointtime = 0;
+ }
+ spectatee_status = newspectatee_status;
+}
+
void Ent_Nagger()
{
float nags;
@@ -555,6 +584,8 @@
Ent_ScoresInfo();
else if(self.enttype == ENT_CLIENT_MAPVOTE)
Ent_MapVote();
+ else if(self.enttype == ENT_CLIENT_CLIENTDATA)
+ Ent_ClientData();
else
error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
@@ -648,14 +679,6 @@
localcmd(strcat("\nfog ", forcefog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
}
-void Net_ReadFog()
-{
- if(forcefog)
- strunzone(forcefog);
- ReadCoord(); // ignore fog interval
- forcefog = strzone(ReadString());
-}
-
void Gamemode_Init();
void Ent_ScoresInfo()
{
@@ -689,8 +712,12 @@
hook_shotorigin_x = ReadCoord();
hook_shotorigin_y = ReadCoord();
hook_shotorigin_z = ReadCoord();
+
+ if(forcefog)
+ strunzone(forcefog);
+ forcefog = strzone(ReadString());
+
CSQC_CheckRevision();
-
if(!postinit)
PostInit();
}
@@ -716,15 +743,6 @@
return img;
}
-void Net_Config()
-{
- string key, value;
- key = ReadString();
- value = ReadString();
- db_put(configdb, strcat("/v/", key), value);
- db_put(configdb, strcat("/s/", key), "1");
-}
-
void Net_ReadRace()
{
float b;
@@ -792,36 +810,6 @@
}
}
-void Net_ReadForceScoreboard()
-{
- sb_showscores_force = ReadByte();
-}
-
-void Net_Reset()
-{
- float i;
- race_laptime = 0;
- race_checkpointtime = 0;
- for(i = 0; i < 24; ++i)
- angles_held_status[i] = 0;
-}
-
-void Net_ReadSpectating()
-{
- float newspectatee_status;
- newspectatee_status = ReadByte();
- if(newspectatee_status == player_localentnum)
- newspectatee_status = -1; // observing
- if(newspectatee_status != spectatee_status)
- Net_Reset();
- spectatee_status = newspectatee_status;
-}
-
-void Net_ReadZoomNotify()
-{
- spectatorbutton_zoom = ReadByte();
-}
-
void Net_ReadSpawn()
{
zoomin_effect = 1;
@@ -831,7 +819,6 @@
// CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
// You must ALWAYS first acquire the temporary ID, which is sent as a byte.
// Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
-void Net_ReadHoldAngles();
float CSQC_Parse_TempEntity()
{
local float bHandled;
@@ -847,22 +834,10 @@
Net_MapVote_Picture();
bHandled = true;
break;
- case TE_CSQC_CONFIG:
- Net_Config();
- bHandled = true;
- break;
case TE_CSQC_RACE:
Net_ReadRace();
bHandled = true;
break;
- case TE_CSQC_FORCESCOREBOARD:
- Net_ReadForceScoreboard();
- bHandled = true;
- break;
- case TE_CSQC_SPECTATING:
- Net_ReadSpectating();
- bHandled = true;
- break;
case 13: // TE_BEAM
Net_GrapplingHook();
bHandled = true;
@@ -871,18 +846,6 @@
Net_ReadSpawn();
bHandled = true;
break;
- case TE_CSQC_ZOOMNOTIFY:
- Net_ReadZoomNotify();
- bHandled = true;
- break;
- case TE_CSQC_HOLDANGLES:
- Net_ReadHoldAngles();
- bHandled = true;
- break;
- case TE_CSQC_FOG:
- Net_ReadFog();
- bHandled = true;
- break;
default:
// No special logic for this temporary entity; return 0 so the engine can handle it
bHandled = false;
Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/client/View.qc 2009-01-28 18:29:31 UTC (rev 5687)
@@ -1,20 +1,3 @@
-vector angles_held[24];
-void Net_ReadHoldAngles()
-{
- float wpn;
- vector v;
- wpn = ReadByte();
- --wpn;
- angles_held_status[wpn] = ReadByte();
- if(angles_held_status[wpn])
- {
- v_x = ReadAngle();
- v_y = ReadAngle();
- v_z = 0;
- angles_held[wpn] = v;
- }
-}
-
entity porto;
vector polyline[16];
float trace_dphitcontents;
@@ -30,9 +13,9 @@
dir = view_forward;
- if(angles_held_status[WEP_PORTO-1])
+ if(angles_held_status)
{
- makevectors(angles_held[WEP_PORTO-1]);
+ makevectors(angles_held);
dir = v_forward;
}
Modified: trunk/data/qcsrc/client/main.qh
===================================================================
--- trunk/data/qcsrc/client/main.qh 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/client/main.qh 2009-01-28 18:29:31 UTC (rev 5687)
@@ -103,8 +103,6 @@
#define CSQC_FLAG_READPICTURE 1
#define CSQC_FLAG_COLORCODES 2
-string config_get(string key, string defaultvalue);
-
entity playerslots[255]; // 255 is engine limit on maxclients
entity teamslots[17]; // 17 teams (including "spectator team")
.float gotscores;
@@ -126,7 +124,6 @@
float warmup_stage;
float weaponimpulse[24];
-float angles_held_status[24];
string getcommandkey(string text, string command);
float sbar_showbinds;
float sbar_showbinds_limit;
Modified: trunk/data/qcsrc/client/mapvoting.qc
===================================================================
--- trunk/data/qcsrc/client/mapvoting.qc 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/client/mapvoting.qc 2009-01-28 18:29:31 UTC (rev 5687)
@@ -263,7 +263,7 @@
void MapVote_Init()
{
- float i, power, m;
+ float i, power;
string map, pk3, ssdir;
registercmd("+showscores");
Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/common/constants.qh 2009-01-28 18:29:31 UTC (rev 5687)
@@ -42,6 +42,17 @@
const float AS_FLOAT_TRUNCATED = 2;
const float AS_FLOAT = 8;
+const float TE_CSQC_PICTURE = 100;
+const float TE_CSQC_RACE = 101;
+const float TE_CSQC_SPAWN = 102;
+
+const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
+const float RACE_NET_CHECKPOINT_CLEAR = 1;
+const float RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
+const float RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
+const float RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
+const float RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
+
const float ENT_CLIENT = 0;
const float ENT_CLIENT_DEAD = 1;
const float ENT_CLIENT_ENTCS = 2;
@@ -60,6 +71,7 @@
const float ENT_CLIENT_CASING = 15;
const float ENT_CLIENT_INIT = 16;
const float ENT_CLIENT_MAPVOTE = 17;
+const float ENT_CLIENT_CLIENTDATA = 18;
const float SPRITERULE_DEFAULT = 0;
const float SPRITERULE_TEAMPLAY = 1;
@@ -210,23 +222,6 @@
///////////////////////////
// csqc communication stuff
-const float ENTCS_MSG_END = 0;
-const float ENTCS_MSG_ONS_GPS = 1;
-const float ENTCS_MSG_ONS_REMOVE = 2;
-const float ENTCS_MSG_INIT = 3;
-
-const float TE_CSQC_PICTURE = 105;
-const float TE_CSQC_CONFIG = 107; // TODO maybe turn into shared ent (but it's unused anyway)
-const float TE_CSQC_RACE = 109;
-const float TE_CSQC_FORCESCOREBOARD = 110; // TODO turn into shared ent
-const float TE_CSQC_SPECTATING = 111; // TODO turn into shared ent
-const float TE_CSQC_SPAWN = 112;
-const float TE_CSQC_ZOOMNOTIFY = 113; // TODO turn into shared ent
-const float TE_CSQC_HOLDANGLES = 114; // TODO turn into shared ent
-const float TE_CSQC_FOG = 116; // TODO turn into shared ent
-
-// ideas: turn TE_CSQC_FORCESCOREBOARD, TE_CSQC_SPECTATING, TE_CSQC_ZOOMNOTIFY, TE_CSQC_HOLDANGLES into a single shared ent, the other two in ones for their own
-
const float STAT_KH_KEYS = 32;
const float STAT_CTF_STATE = 33;
const float STAT_SYS_TICRATE = 34;
@@ -241,13 +236,6 @@
// # of maps, I'll use arrays for them :P
#define MAPVOTE_COUNT 10
-const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
-const float RACE_NET_CHECKPOINT_CLEAR = 1;
-const float RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
-const float RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
-const float RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
-const float RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
-
/**
* Lower scores are better (e.g. suicides)
*/
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/server/cl_client.qc 2009-01-28 18:29:31 UTC (rev 5687)
@@ -1,3 +1,79 @@
+.float spectatee_status;
+.float zoomstate;
+
+.entity clientdata;
+float ClientData_Send(entity to, float sf)
+{
+ if(to != self.owner)
+ {
+ error("wtf");
+ return FALSE;
+ }
+
+ entity e;
+
+ e = to;
+ if(to.classname == "spectator")
+ e = to.enemy;
+
+ sf = 0;
+
+ if(e.race_completed)
+ sf |= 1; // forced scoreboard
+ if(to.spectatee_status)
+ sf |= 2; // spectator ent number follows
+ if(e.zoomstate)
+ sf |= 4; // zoomed
+ if(e.porto_v_angle_held)
+ sf |= 8; // angles held
+
+ WriteByte(MSG_ENTITY, ENT_CLIENT_CLIENTDATA);
+ WriteByte(MSG_ENTITY, sf);
+
+ if(sf & 2)
+ WriteByte(MSG_ENTITY, to.spectatee_status);
+
+ if(sf & 8)
+ {
+ WriteAngle(MSG_ENTITY, e.v_angle_x);
+ WriteAngle(MSG_ENTITY, e.v_angle_y);
+ }
+
+ return TRUE;
+}
+
+void ClientData_Attach()
+{
+ self.clientdata = spawn();
+ self.clientdata.SendEntity = ClientData_Send;
+ self.clientdata.effects = EF_NODEPTHTEST;
+ self.clientdata.drawonlytoclient = self;
+ self.clientdata.owner = self;
+ setmodel(self.clientdata, "null");
+}
+
+void ClientData_Detach()
+{
+ remove(self.clientdata);
+ self.clientdata = world;
+}
+
+void ClientData_Touch(entity e)
+{
+ e.clientdata.SendFlags = 1;
+
+ // make it spectatable
+ entity e2;
+ FOR_EACH_REALCLIENT(e2)
+ {
+ if(e2 != e)
+ if(e2.classname == "spectator")
+ if(e2.enemy == e)
+ e2.clientdata.SendFlags = 1;
+ }
+}
+
+
#define SPAWNPOINT_SCORE frags
.float wantswelcomemessage;
@@ -834,6 +910,12 @@
WriteCoord(MSG_ENTITY, hook_shotorigin_x);
WriteCoord(MSG_ENTITY, hook_shotorigin_y);
WriteCoord(MSG_ENTITY, hook_shotorigin_z);
+
+ if(sv_foginterval && world.fog != "")
+ WriteString(MSG_ENTITY, world.fog);
+ else
+ WriteString(MSG_ENTITY, "");
+
return TRUE;
}
@@ -1088,31 +1170,6 @@
*/
}
-.float fog_set;
-void SendFog()
-{
- if(clienttype(self) == CLIENTTYPE_REAL)
- if(world.fog) // NOT string_null!
- {
- if(!self.fog_set)
- {
- if(sv_foginterval)
- {
- msg_entity = self;
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_FOG);
- WriteCoord(MSG_ONE, sv_foginterval);
- WriteString(MSG_ONE, world.fog);
- }
- else
- // set it once
- stuffcmd(self, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
-
- self.fog_set = 1;
- }
- }
-}
-
/*
=============
ClientConnect
@@ -1151,6 +1208,7 @@
}
PlayerScore_Attach(self);
+ ClientData_Attach();
bot_clientconnect();
@@ -1281,7 +1339,8 @@
}
}
- SendFog();
+ if(!sv_foginterval && world.fog != "")
+ stuffcmd(self, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
}
/*
@@ -1348,6 +1407,7 @@
Spawnqueue_Remove(self);
}
+ ClientData_Detach();
PlayerScore_Detach(self);
if(self.netname_previous)
@@ -1706,18 +1766,11 @@
self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
}
-.float zoomstate;
float zoomstate_set;
void SetZoomState(float z)
{
if(z != self.zoomstate)
- {
- msg_entity = self;
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_ZOOMNOTIFY);
- WriteByte(MSG_ONE, z);
- self.zoomstate = z;
- }
+ ClientData_Touch(self);
zoomstate_set = 1;
}
@@ -1992,7 +2045,6 @@
=============
*/
void() ctf_setstatus;
-.float spectatee_status;
void PlayerPreThink (void)
{
self.stat_sys_ticrate = cvar("sys_ticrate");
@@ -2052,10 +2104,7 @@
}
if(frametime)
- {
- SendFog();
antilag_record(self);
- }
if(self.classname == "player") {
// if(self.netname == "Wazat")
@@ -2249,10 +2298,7 @@
self.spectatee_status = 0;
if(self.spectatee_status != oldspectatee_status)
{
- msg_entity = self;
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_SPECTATING);
- WriteByte(MSG_ONE, self.spectatee_status);
+ ClientData_Touch(self);
if(g_race)
race_InitSpectator();
}
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/server/defs.qh 2009-01-28 18:29:31 UTC (rev 5687)
@@ -529,3 +529,5 @@
.void() reset; // if set, an entity is reset using this
.void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
+
+void ClientData_Touch(entity e);
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/server/g_world.qc 2009-01-28 18:29:31 UTC (rev 5687)
@@ -2248,9 +2248,6 @@
}
void MapVote_Tick()
{
- string msgstr;
- string tmp;
- float i;
float keeptwo;
float totalvotes;
Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/server/race.qc 2009-01-28 18:29:31 UTC (rev 5687)
@@ -115,15 +115,7 @@
e.race_completed = 1;
MAKE_INDEPENDENT_PLAYER(e);
bprint(e.netname, "^7 has finished the race.\n");
- // TODO support spectators with this (e.g. set a flag for forced sbar)
- if(clienttype(e) == CLIENTTYPE_REAL)
- {
- msg_entity = e;
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_FORCESCOREBOARD);
- WriteByte(MSG_ONE, 1);
- // he can still move, but will see the scoreboard now
- }
+ ClientData_Touch(e);
}
}
}
@@ -451,15 +443,7 @@
p.race_completed = 1;
MAKE_INDEPENDENT_PLAYER(p);
bprint(p.netname, "^7 has abandoned the race.\n");
- // TODO support spectators with this (e.g. set a flag for forced sbar)
- if(clienttype(p) == CLIENTTYPE_REAL)
- {
- msg_entity = p;
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_FORCESCOREBOARD);
- WriteByte(MSG_ONE, 1);
- // he can still move, but will see the scoreboard now
- }
+ ClientData_Touch(p);
}
}
Modified: trunk/data/qcsrc/server/w_porto.qc
===================================================================
--- trunk/data/qcsrc/server/w_porto.qc 2009-01-28 17:44:32 UTC (rev 5686)
+++ trunk/data/qcsrc/server/w_porto.qc 2009-01-28 18:29:31 UTC (rev 5687)
@@ -219,13 +219,9 @@
if(!self.BUTTON_ATCK2)
{
msg_entity = self;
- WRITESPECTATABLE_MSG_ONE_VARNAME(dummy1, {
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_HOLDANGLES);
- WriteByte(MSG_ONE, WEP_PORTO);
- WriteByte(MSG_ONE, 0);
- });
self.porto_v_angle_held = 0;
+
+ ClientData_Touch(self);
}
}
else
@@ -234,15 +230,9 @@
{
self.porto_v_angle = self.v_angle;
msg_entity = self;
- WRITESPECTATABLE_MSG_ONE_VARNAME(dummy2, {
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_HOLDANGLES);
- WriteByte(MSG_ONE, WEP_PORTO);
- WriteByte(MSG_ONE, 1);
- WriteAngle(MSG_ONE, self.v_angle_x);
- WriteAngle(MSG_ONE, self.v_angle_y);
- });
self.porto_v_angle_held = 1;
+
+ ClientData_Touch(self);
}
}
v_angle_save = self.v_angle;
More information about the nexuiz-commits
mailing list