r3187 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Jan 19 06:23:55 EST 2008


Author: div0
Date: 2008-01-19 06:23:55 -0500 (Sat, 19 Jan 2008)
New Revision: 3187

Modified:
   trunk/data/qcsrc/server/extensions.qh
   trunk/data/qcsrc/server/g_world.qc
Log:
make use of DP_SV_SHUTDOWN


Modified: trunk/data/qcsrc/server/extensions.qh
===================================================================
--- trunk/data/qcsrc/server/extensions.qh	2008-01-19 10:31:40 UTC (rev 3186)
+++ trunk/data/qcsrc/server/extensions.qh	2008-01-19 11:23:55 UTC (rev 3187)
@@ -795,6 +795,15 @@
 //
 //this is basically a poor man's garbage collection system for strings.
 
+//DP_QC_VECTOANGLES_WITH_ROLL
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+vector(vector forward, vector up) vectoangles2 = #51; // same number as vectoangles
+//description:
+//variant of vectoangles that takes an up vector to calculate roll angle (also uses this to calculate yaw correctly if the forward is straight up or straight down)
+//note: just like normal vectoangles you need to negate the pitch of the returned angles if you want to feed them to makevectors or assign to self.v_angle
+
 //DP_QC_VECTORVECTORS
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
@@ -995,6 +1004,25 @@
 //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_POINTSOUND
+//idea: Dresk
+//darkplaces implementation: Dresk
+//builtin definitions:
+void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
+//description:
+//Similar to the standard QC sound function, this function takes an origin instead of an entity and omits the channel parameter.
+// This allows sounds to be played at arbitrary origins without spawning entities.
+
+//DP_SV_ONENTITYNOSPAWNFUNCTION
+//idea: Dresk
+//darkplaces implementation: Dresk
+//engine-called QC prototypes:
+//void() SV_OnEntityNoSpawnFunction;
+//description:
+// This function is called whenever an entity on the server has no spawn function, and therefore has no defined QC behavior.
+// You may as such dictate the behavior as to what happens to the entity.
+// To mimic the engine's default behavior, simply call remove(self).
+
 //DP_SV_MODELFLAGS_AS_EFFECTS
 //idea: LordHavoc, Dresk
 //darkplaces implementation: LordHavoc
@@ -1539,6 +1567,27 @@
 float(string s1, string s2) strcasecmp = #229;
 float(string s1, string s2, float len) strncasecmp = #230;
 
+//DP_CON_BESTWEAPON
+//idea: many
+//darkplaces implementation: div0
+//description:
+//allows QC to register weapon properties for use by the bestweapon command, for mods that change required ammo count or type for the weapons
+//it is done using console commands sent via stuffcmd:
+//  register_bestweapon quake
+//  register_bestweapon clear
+//  register_bestweapon <shortname> <impulse> <itemcode> <activeweaponcode> <ammostat> <ammomin>
+//for example, this is what Quake uses:
+//  register_bestweapon 1 1 4096 4096 6 0 // STAT_SHELLS is 6
+//  register_bestweapon 2 2    1    1 6 1
+//  register_bestweapon 3 3    2    2 6 1
+//  register_bestweapon 4 4    4    4 7 1 // STAT_NAILS is 7
+//  register_bestweapon 5 5    8    8 7 1
+//  register_bestweapon 6 6   16   16 8 1 // STAT_ROCKETS is 8
+//  register_bestweapon 7 7   32   32 8 1
+//  register_bestweapon 8 8   64   64 9 1 // STAT_CELLS is 9
+//after each map client initialization, this is reset back to Quake settings. So you should send these data in ClientConnect.
+//also, this extension introduces a new "cycleweapon" command to the user.
+
 //DP_QC_STRINGBUFFERS
 //idea: ??
 //darkplaces implementation: LordHavoc
@@ -1554,9 +1603,26 @@
 float(float bufhandle, string str, float order) bufstr_add = #468;
 void(float bufhandle, float string_index) bufstr_free = #469;
 
+//DP_QC_STRREPLACE
+//idea: Sajt
+//darkplaces implementation: Sajt
+//builtin definitions:
+string(string search, string replace, string subject) strreplace = #484;
+string(string search, string replace, string subject) strireplace = #485;
+//description:
+//strreplace replaces all occurrences of 'search' with 'replace' in the string 'subject', and returns the result as a tempstring.
+//strireplace does the same but uses case-insensitive matching of the 'search' term
+//
 //DP_QC_CRC16
 //idea: div0
 //darkplaces implementation: div0
 //Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
 //When caseinsensitive is set, the CRC is calculated of the lower cased string.
 float(float caseinsensitive, string s, ...) crc16 = #494;
+
+//DP_SV_SHUTDOWN
+//idea: div0
+//darkplaces implementation: div0
+//A function that gets called just before progs exit. To save persistent data from.
+//It is not called on a crash or error.
+//void SV_Shutdown();

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-01-19 10:31:40 UTC (rev 3186)
+++ trunk/data/qcsrc/server/g_world.qc	2008-01-19 11:23:55 UTC (rev 3187)
@@ -1,5 +1,6 @@
 float SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS = 1;
 string redirection_target;
+float world_initialized;
 
 string GetMapname();
 string GetGametype();
@@ -236,6 +237,8 @@
 	MapInfo_Enumerate();
 	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 1);
 #endif
+
+	world_initialized = 1;
 }
 
 void light (void)
@@ -458,9 +461,6 @@
 
 	localcmd("exec game_reset.cfg\n");
 #endif
-
-	Ban_SaveBans();
-	db_save(ServerProgsDB, "server.db");
 };
 
 void() Map_Goto =
@@ -628,9 +628,6 @@
 
 float() DoNextMapOverride =
 {
-	Ban_SaveBans();
-	db_save(ServerProgsDB, "server.db");
-
 	if(cvar("g_campaign"))
 	{
 		CampaignPostIntermission();
@@ -930,9 +927,6 @@
 
 	gameover = TRUE;
 
-	Ban_SaveBans();
-	db_save(ServerProgsDB, "server.db");
-
 	intermission_running = 1;
 
 // enforce a wait time before allowing changelevel
@@ -2151,3 +2145,19 @@
 
 	return TRUE;
 }
+
+void SV_Shutdown()
+{
+	if(world_initialized)
+	{
+		world_initialized = 0;
+		print("Saving persistent data...\n");
+		Ban_SaveBans();
+		db_save(ServerProgsDB, "server.db");
+		print("done!\n");
+	}
+	else
+	{
+		print("NOTE: crashed before even initializing the world, not saving persistent data\n");
+	}
+}




More information about the nexuiz-commits mailing list