[nexuiz-commits] r7697 - in trunk/data: . qcsrc/client qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Sep 8 12:10:52 EDT 2009
Author: mrbougo
Date: 2009-09-08 12:10:52 -0400 (Tue, 08 Sep 2009)
New Revision: 7697
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/View.qc
trunk/data/qcsrc/client/main.qh
trunk/data/qcsrc/server/builtins.qh
trunk/data/qcsrc/server/clientcommands.qc
trunk/data/qcsrc/server/g_world.qc
Log:
define localcmd correctly in svqc; add client- and serverside alias hooks on start and end of a match, as well as a serverside ready-restart hook
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-09-08 15:21:24 UTC (rev 7696)
+++ trunk/data/defaultNexuiz.cfg 2009-09-08 16:10:52 UTC (rev 7697)
@@ -1646,6 +1646,45 @@
set g_mapinfo_settemp_acl "+*" "ACL for mapinfo setting cvars"
+// hooks
+alias _cl_hook_gamestart "set _cl_hook_gametype $1; _cl_hook_gamestart_stage2"
+alias _cl_hook_gamestart_stage2 "cl_hook_gamestart_all; cl_hook_gamestart_${_cl_hook_gametype}"
+alias cl_hook_gamestart_all
+alias cl_hook_gamestart_nop //is only called when CSQC unloads before knowing the gametype, very unlikely
+alias cl_hook_gamestart_dm
+alias cl_hook_gamestart_tdm
+alias cl_hook_gamestart_dom
+alias cl_hook_gamestart_ctf
+alias cl_hook_gamestart_rune
+alias cl_hook_gamestart_lms
+alias cl_hook_gamestart_arena
+alias cl_hook_gamestart_kh
+alias cl_hook_gamestart_ons
+alias cl_hook_gamestart_as
+alias cl_hook_gamestart_rc
+alias cl_hook_gamestart_nexball
+alias cl_hook_gamestart_cts
+alias cl_hook_gameend
+
+alias _sv_hook_gamestart "set _sv_hook_gametype $1; _sv_hook_gamestart_stage2"
+alias _sv_hook_gamestart_stage2 "sv_hook_gamestart_all; sv_hook_gamestart_${_sv_hook_gametype}"
+alias sv_hook_gamestart_all
+alias sv_hook_gamestart_dm
+alias sv_hook_gamestart_tdm
+alias sv_hook_gamestart_dom
+alias sv_hook_gamestart_ctf
+alias sv_hook_gamestart_rune
+alias sv_hook_gamestart_lms
+alias sv_hook_gamestart_arena
+alias sv_hook_gamestart_kh
+alias sv_hook_gamestart_ons
+alias sv_hook_gamestart_as
+alias sv_hook_gamestart_rc
+alias sv_hook_gamestart_nexball
+alias sv_hook_gamestart_cts
+alias sv_hook_gamerestart
+alias sv_hook_gameend
+
cl_netfps 60 // moar
seta cl_casings_maxcount 100 "maximum amount of shell casings (must be at least 1)"
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2009-09-08 15:21:24 UTC (rev 7696)
+++ trunk/data/qcsrc/client/Main.qc 2009-09-08 16:10:52 UTC (rev 7697)
@@ -115,6 +115,8 @@
postinit = false;
+ calledhooks = 0;
+
teams = Sort_Spawn();
players = Sort_Spawn();
@@ -170,6 +172,14 @@
if(camera_active)
cvar_set("chase_active",ftos(chase_active_backup));
+
+ if not(isdemo())
+ {
+ if not(calledhooks & HOOK_START)
+ localcmd("\n_cl_hook_gamestart nop;");
+ if not(calledhooks & HOOK_END)
+ localcmd("\ncl_hook_gameend;");
+ }
}
.float has_team;
@@ -853,6 +863,12 @@
precache_pic("gfx/sb_key_carrying");
precache_pic("gfx/sb_key_carrying_outline");
}
+
+ if not(isdemo())
+ {
+ localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";");
+ calledhooks |= HOOK_START;
+ }
}
// CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided. To execute standard behavior, simply execute localcmd with the string.
void CSQC_Parse_StuffCmd(string strMessage)
Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc 2009-09-08 15:21:24 UTC (rev 7696)
+++ trunk/data/qcsrc/client/View.qc 2009-09-08 16:10:52 UTC (rev 7697)
@@ -383,6 +383,13 @@
if(!postinit)
PostInit();
+ if(intermission && !isdemo() && !(calledhooks & HOOK_END))
+ if(calledhooks & HOOK_START)
+ {
+ localcmd("\ncl_hook_gameend;");
+ calledhooks |= HOOK_END;
+ }
+
CheckForGamestartChange();
maptimeAnnouncer();
Modified: trunk/data/qcsrc/client/main.qh
===================================================================
--- trunk/data/qcsrc/client/main.qh 2009-09-08 15:21:24 UTC (rev 7696)
+++ trunk/data/qcsrc/client/main.qh 2009-09-08 16:10:52 UTC (rev 7697)
@@ -152,3 +152,8 @@
#define ALPHA_MIN_VISIBLE 0.003
float armorblockpercent;
+
+//hooks
+float calledhooks;
+#define HOOK_START 1
+#define HOOK_END 2
Modified: trunk/data/qcsrc/server/builtins.qh
===================================================================
--- trunk/data/qcsrc/server/builtins.qh 2009-09-08 15:21:24 UTC (rev 7696)
+++ trunk/data/qcsrc/server/builtins.qh 2009-09-08 16:10:52 UTC (rev 7697)
@@ -44,7 +44,7 @@
float fabs (float f) = #43;
vector(entity e, float speed) aim = #44;
float cvar (string s) = #45;
-void localcmd (string s) = #46;
+void localcmd (string s, ...) = #46;
entity nextent (entity e) = #47;
void particle (vector v, vector d, float colour, float count) = #48;
void ChangeYaw (void) = #49;
Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc 2009-09-08 15:21:24 UTC (rev 7696)
+++ trunk/data/qcsrc/server/clientcommands.qc 2009-09-08 16:10:52 UTC (rev 7697)
@@ -781,6 +781,8 @@
// no arena, assault support yet...
if(g_arena | g_assault | gameover | intermission_running | race_completing)
localcmd("restart\n");
+ else
+ localcmd("\nsv_hook_gamerestart;");
ReadyRestartForce();
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2009-09-08 15:21:24 UTC (rev 7696)
+++ trunk/data/qcsrc/server/g_world.qc 2009-09-08 16:10:52 UTC (rev 7697)
@@ -645,6 +645,8 @@
ClientInit_Spawn();
RandomSeed_Spawn();
+ localcmd("\n_sv_hook_gamestart ", GetGametype(), ";");
+
world_initialized = 1;
}
@@ -1354,6 +1356,8 @@
if(cvar("g_campaign"))
CampaignPreIntermission();
+ localcmd("\nsv_hook_gameend;");
+
// WriteByte (MSG_ALL, SVC_INTERMISSION);
};
More information about the nexuiz-commits
mailing list