r2789 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Aug 6 04:55:11 EDT 2007


Author: div0
Date: 2007-08-06 04:55:11 -0400 (Mon, 06 Aug 2007)
New Revision: 2789

Modified:
   trunk/data/default.cfg
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/extensions.qh
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/t_quake.qc
Log:
update extensions.qh;
make use of FTE_STRINGS for strstr and strpad;
prevent the last g_maplist_mostrecent_count maps from being played again


Modified: trunk/data/default.cfg
===================================================================
--- trunk/data/default.cfg	2007-07-13 18:58:15 UTC (rev 2788)
+++ trunk/data/default.cfg	2007-08-06 08:55:11 UTC (rev 2789)
@@ -222,6 +222,8 @@
 set g_norecoil 0
 set g_throughfloor 1
 set g_maplist_defaultlist 'dm_aggressor''dm_aneurysm''dm_basement''dm_bleach''dm_bloodprison''dm_bluesky''dm_darkzone''dm_dieselpower''dm_downer''dm_evilspace''dm_farewell''dm_final_rage''dm_reslimed''dm_ruiner''dm_runningman_1on1remix''dm_runningman''dm_silvercity''dm_skyway''dm_soylent''dm_starship''dm_stormkeep''dm_toxic''dm_warfare'
+set g_maplist_mostrecent ""
+seta g_maplist_mostrecent_count 3 // number of most recent maps that are blocked from being played again
 seta g_maplist $g_maplist_defaultlist
 seta g_maplist_index 0 // this is used internally for saving position in maplist cycle
 seta g_maplist_selectrandom 0 // if 1, a random map will be chosen as next map - DEPRECATED in favor of g_maplist_shuffle
@@ -584,6 +586,8 @@
 set sv_vote_simple_majority 0
 // when disabled, don't allow game type changes
 set sv_vote_change_gametype 0
+// when enabled, votes may override the most recent map list and change to such a map anyway
+set sv_vote_override_mostrecent 0
 alias vhelp "cmd vote help"
 alias vstatus "cmd vote status"
 alias vcall "cmd vote call $*"
@@ -695,6 +699,7 @@
 seta g_maplist_votable_timeout 30 // note: must be below 50 seconds!
 seta g_maplist_votable_suggestions 2
 seta g_maplist_votable_suggestions_change_gametype 0
+seta g_maplist_votable_suggestions_override_mostrecent 0
 alias suggestmap "cmd suggestmap $1"
 
 set g_chat_flood_spl 0                   // seconds between lines to not count as flooding

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2007-07-13 18:58:15 UTC (rev 2788)
+++ trunk/data/qcsrc/server/clientcommands.qc	2007-08-06 08:55:11 UTC (rev 2789)
@@ -502,6 +502,12 @@
 			sprint(self, "This server does not allow changing the game type by map votes.\n");
 			return FALSE;
 		}
+	if(!cvar("sv_vote_override_mostrecent"))
+		if(Map_IsRecent(argv(1)))
+		{
+			sprint(self, "This server does not allow for recent maps to be played again. Please be patient for some rounds.\n");
+			return FALSE;
+		}
 
 	if(!TryFile(strcat("maps/", argv(1), ext)))
 	{

Modified: trunk/data/qcsrc/server/extensions.qh
===================================================================
--- trunk/data/qcsrc/server/extensions.qh	2007-07-13 18:58:15 UTC (rev 2788)
+++ trunk/data/qcsrc/server/extensions.qh	2007-08-06 08:55:11 UTC (rev 2789)
@@ -154,6 +154,20 @@
 //description:
 //prevents server from sending entity to client (forced invisible, even if it would have been a light source or other such things)
 
+//DP_EF_NOGUNBOB
+//idea: Chris Page, Dresk
+//darkplaces implementation: LordHAvoc
+//effects bit:
+float   EF_NOGUNBOB     = 256;
+//description:
+//this has different meanings depending on the entity it is used on:
+//player entity - prevents gun bobbing on player.viewmodel
+//viewmodelforclient entity - prevents gun bobbing on an entity attached to the player's view
+//other entities - no effect
+//uses:
+//disabling gun bobbing on a diving mask or other model used as a .viewmodel.
+//disabling gun bobbing on view-relative models meant to be part of the heads up display.  (note: if fov is changed these entities may be off-screen, or too near the center of the screen, so use fov 90 in this case)
+
 //DP_EF_NOSHADOW
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
@@ -505,6 +519,14 @@
 //description:
 //copies all data in the entity to another entity.
 
+//DP_QC_CVAR_DEFSTRING
+//idea: id Software (Doom3), LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+string(string s) cvar_defstring = #482;
+//description:
+//returns the default value of a cvar, as a tempstring.
+
 //DP_QC_CVAR_STRING
 //idea: VorteX
 //DarkPlaces implementation: VorteX, LordHavoc
@@ -696,6 +718,15 @@
 //description:
 //provides additional functionality to strings by supporting functions that isolate and identify strings with color codes
 
+//DP_QC_STRING_CASE_FUNCTIONS
+//idea: Dresk
+//darkplaces implementation: LordHavoc / Dresk
+//builtin definitions:
+string(string s) strtolower = #480; // returns the passed in string in pure lowercase form
+string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form
+//description:
+//provides simple string uppercase and lowercase functions
+
 //DP_QC_TOKENIZEBYSEPARATOR
 //idea: Electro, SavageX, LordHavoc
 //darkplaces implementation: LordHavoc
@@ -964,6 +995,42 @@
 //The first parameter provides the entities original contents, prior to the transition.  The second parameter provides the new contents.
 //NOTE: If this field function is provided on an entity, the standard watersplash sound IS SUPPRESSED to allow for authors to create their own transition sounds.
 
+//DP_SV_MODELFLAGS_AS_EFFECTS
+//idea: LordHavoc, Dresk
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float modelflags;
+//constant definitions:
+float EF_NOMODELFLAGS = 8388608; // ignore any effects in a model file and substitute your own
+float MF_ROCKET  =   1; // leave a trail
+float MF_GRENADE =   2; // leave a trail
+float MF_GIB     =   4; // leave a trail
+float MF_ROTATE  =   8; // rotate (bonus items)
+float MF_TRACER  =  16; // green split trail
+float MF_ZOMGIB  =  32; // small blood trail
+float MF_TRACER2 =  64; // orange split trail
+float MF_TRACER3 = 128; // purple trail
+//description:
+//this extension allows model flags to be specified on entities so you can add a rocket trail and glow to any entity, etc.
+//setting any of these will override the flags the model already has, to disable the model's flags without supplying any of your own you must use EF_NOMODELFLAGS.
+//
+//silly example modification #1 to W_FireRocket in weapons.qc:
+//missile.effects = EF_NOMODELFLAGS; // rocket without a glow/fire trail
+//silly example modification #2 to W_FireRocket in weapons.qc:
+//missile.modelflags = MF_GIB; // leave a blood trail instead of glow/fire trail
+//
+//note: you can not combine multiple kinds of trail, only one of them will be active, you can combine MF_ROTATE and the other MF_ flags however, and using EF_NOMODELFLAGS along with these does no harm.
+//
+//note to engine coders: they are internally encoded in the protocol as extra EF_ flags (shift the values left 24 bits and send them in the protocol that way), so no protocol change was required (however 32bit effects is a protocol extension itself), within the engine they are referred to as EF_ for the 24bit shifted values.
+
+//DP_SV_NETADDRESS
+//idea: Dresk
+//darkplaces implementation: Dresk
+//field definitions:
+.string netaddress;
+//description:
+// provides the netaddress of the associated entity (ie. 127.0.0.1) and "null/botclient" if the netconnection of the entity is invalid
+
 //DP_SV_NODRAWTOCLIENT
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
@@ -980,6 +1047,18 @@
 //description:
 //continuously updated field indicating client's ping (based on average of last 16 packet time differences).
 
+//DP_SV_POINTPARTICLES
+//idea: Spike
+//darkplaces implementation: LordHavoc
+//function definitions:
+float(string effectname) particleeffectnum = #335; // same as in CSQC
+void(entity ent, float effectnum, vector start, vector end) trailparticles = #336; // same as in CSQC
+void(float effectnum, vector org, vector vel, float howmany) pointparticles = #337; // same as in CSQC
+//description:
+//provides the ability to spawn non-standard particle effects, typically these are defined in a particle effect information file such as effectinfo.txt in darkplaces.
+//this is a port of particle effect features from clientside QC (EXT_CSQC) to server QC, as these effects are potentially useful to all games even if they do not make use of EXT_CSQC.
+//warning: server must have same order of effects in effectinfo.txt as client does or the numbers would not match up, except for standard quake effects which are always the same numbers.
+
 //DP_SV_PUNCHVECTOR
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
@@ -1000,18 +1079,6 @@
 //description:
 //.movement vector contains the movement input from the player, allowing QC to do as it wishs with the input, and SV_PlayerPhysics will completely replace the player physics if present (works for all MOVETYPE's), see darkplaces mod source for example of this function (in playermovement.qc, adds HalfLife ladders support, as well as acceleration/deceleration while airborn (rather than the quake sudden-stop while airborn), and simplifies the physics a bit)
 
-//DP_SV_POINTPARTICLES
-//idea: Spike
-//darkplaces implementation: LordHavoc
-//function definitions:
-float(string effectname) particleeffectnum = #335; // same as in CSQC
-void(entity ent, float effectnum, vector start, vector end) trailparticles = #336; // same as in CSQC
-void(float effectnum, vector org, vector vel, float howmany) pointparticles = #337; // same as in CSQC
-//description:
-//provides the ability to spawn non-standard particle effects, typically these are defined in a particle effect information file such as effectinfo.txt in darkplaces.
-//this is a port of particle effect features from clientside QC (EXT_CSQC) to server QC, as these effects are potentially useful to all games even if they do not make use of EXT_CSQC.
-//warning: server must have same order of effects in effectinfo.txt as client does or the numbers would not match up, except for standard quake effects which are always the same numbers.
-
 //DP_SV_PRINT
 //idea: id Software (QuakeWorld Server)
 //darkplaces implementation: Black, LordHavoc
@@ -1456,4 +1523,18 @@
 //description:
 //sv_jumpstep allows stepping up onto stairs while airborn, sv_stepheight controls how high a single step can be.
 
-.string netaddress; // TODO make this a full block
+//FTE_STRINGS
+//idea: many
+//darkplaces implementation: KrimZon
+//description:
+//various string manipulation functions
+float(string str, string sub, float startpos) strstrofs = #221;
+float(string str, float ofs) str2chr = #222;
+string(float c, ...) chr2str = #223;
+string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
+string(float chars, string s, ...) strpad = #225;
+string(string info, string key, string value, ...) infoadd = #226;
+string(string info, string key) infoget = #227;
+float(string s1, string s2, float len) strncmp = #228;
+float(string s1, string s2) strcasecmp = #229;
+float(string s1, string s2, float len) strncasecmp = #230;

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2007-07-13 18:58:15 UTC (rev 2788)
+++ trunk/data/qcsrc/server/g_world.qc	2007-08-06 08:55:11 UTC (rev 2789)
@@ -467,14 +467,44 @@
 	return strcat("maps/", argv(position), ".mapcfg");
 }
 
+string strwords(string s, float w)
+{
+	float endpos;
+	for(endpos = 0; w && endpos >= 0; --w)
+		endpos = strstrofs(s, " ", endpos + 1);
+	if(endpos < 0)
+		return s;
+	else
+		return substring(s, 0, endpos);
+}
+
+float strhasword(string s, string w)
+{
+	return strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0;
+}
+
+void Map_MarkAsRecent(string m)
+{
+	cvar_set("g_maplist_mostrecent", strwords(strcat(m, " ", cvar_string("g_maplist_mostrecent")), cvar("g_maplist_mostrecent_count")));
+}
+
+float Map_IsRecent(string m)
+{
+	return strhasword(cvar_string("g_maplist_mostrecent"), m);
+}
+
 float(float position, float pass) Map_Check =
 {
 	string filename;
 	string map_next;
 	map_next = argv(position);
 	if(pass <= 1)
+	{
 		if(map_next == Map_Current_Name) // same map again in first pass?
 			return 0;
+		if(Map_IsRecent(map_next))
+			return 0;
+	}
 	filename = Map_Filename(position);
 	if(TryFile(filename))
 	{
@@ -521,6 +551,7 @@
 
 void() Map_Goto =
 {
+	Map_MarkAsRecent(getmapname_stored);
 	GameResetCfg();
 	localcmd(strcat("exec \"maps/", getmapname_stored ,".mapcfg\"\n"));
 }
@@ -1614,7 +1645,6 @@
 float mapvote_maps_suggested[MAPVOTE_COUNT];
 string mapvote_suggestions[MAPVOTE_COUNT];
 float mapvote_suggestion_ptr;
-string mapvote_fillstr;
 float mapvote_maxlen;
 float mapvote_voters;
 float mapvote_votes[MAPVOTE_COUNT];
@@ -1638,9 +1668,10 @@
 		return "Can't suggest - voting is already in progress!";
 	if(!cvar("g_maplist_votable_suggestions_change_gametype"))
 		if(!IsSameGametype(m))
-		{
 			return "This server does not allow changing the game type by map suggestions.";
-		}
+	if(!cvar("g_maplist_votable_override_mostrecent"))
+		if(Map_IsRecent(m))
+			return "This server does not allow for recent maps to be played again. Please be patient for some rounds.";
 
 	if(!TryFile(strcat("maps/", m, ".mapcfg")))
 		return "The map you suggested is not available on this server.";
@@ -1705,11 +1736,6 @@
 
 	//dprint("mapvote count is ", ftos(mapvote_count), "\n");
 
-	mapvote_fillstr = " ";
-	while(strlen(mapvote_fillstr) < mapvote_maxlen + 16)
-		mapvote_fillstr = strcat(mapvote_fillstr, mapvote_fillstr);
-	mapvote_fillstr = strzone(mapvote_fillstr);
-
 	mapvote_keeptwotime = time + cvar("g_maplist_votable_keeptwotime");
 	mapvote_timeout = time + cvar("g_maplist_votable_timeout");
 	if(mapvote_count < 3 || mapvote_keeptwotime <= time)
@@ -1875,13 +1901,13 @@
 			else
 			{
 				tmp = mapvote_maps[i];
-				tmp = strcat(tmp, substring(mapvote_fillstr, 0, mapvote_maxlen  - strlen(tmp)));
+				tmp = strpad(mapvote_maxlen, tmp);
 				tmp = strcat(ftos(math_mod(i + 1, 10)), ": ", tmp);
 				tmp = strcat(tmp, " ^2(", ftos(mapvote_votes[i]), " vote");
 				if(mapvote_votes[i] != 1)
 					tmp = strcat(tmp, "s");
 				tmp = strcat(tmp, ")");
-				tmp = strcat(tmp, substring(mapvote_fillstr, 0, mapvote_maxlen + 15 - strlen(tmp)));
+				tmp = strpad(mapvote_maxlen + 15, tmp);
 				if(other.mapvote == i + 1)
 					msgstr = strcat(msgstr, "^3> ", tmp, "\n");
 				else

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2007-07-13 18:58:15 UTC (rev 2788)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2007-08-06 08:55:11 UTC (rev 2789)
@@ -233,6 +233,8 @@
 	}
 }
 
+#define strstr strstrofs
+/*
 // NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
 // IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
 // STRINGS AND TAKE QUITE LONG. haystack and needle MUST
@@ -252,6 +254,7 @@
 	}
 	return -1;
 }
+*/
 
 float NUM_NEAREST_ENTITIES = 4;
 entity nearest_entity[NUM_NEAREST_ENTITIES];

Modified: trunk/data/qcsrc/server/t_quake.qc
===================================================================
--- trunk/data/qcsrc/server/t_quake.qc	2007-07-13 18:58:15 UTC (rev 2788)
+++ trunk/data/qcsrc/server/t_quake.qc	2007-08-06 08:55:11 UTC (rev 2789)
@@ -45,6 +45,7 @@
 	self.disableclientprediction = 0;
 	self.contentstransition = SUB_Null;
 	self.dphitcontentsmask = 0;
+	self.modelflags = 0;
 	trace_dphittexturename = "";
 }
 




More information about the nexuiz-commits mailing list