[nexuiz-commits] r7728 - in branches/nexuiz-2.0: . data data/qcsrc/client data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Sep 11 04:50:20 EDT 2009
Author: div0
Date: 2009-09-11 04:50:19 -0400 (Fri, 11 Sep 2009)
New Revision: 7728
Modified:
branches/nexuiz-2.0/.patchsets
branches/nexuiz-2.0/data/defaultNexuiz.cfg
branches/nexuiz-2.0/data/qcsrc/client/Main.qc
branches/nexuiz-2.0/data/qcsrc/client/View.qc
branches/nexuiz-2.0/data/qcsrc/client/main.qh
branches/nexuiz-2.0/data/qcsrc/server/builtins.qh
branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc
branches/nexuiz-2.0/data/qcsrc/server/clientcommands.qc
branches/nexuiz-2.0/data/qcsrc/server/g_damage.qc
branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
Log:
r7693 | div0 | 2009-09-08 10:40:33 -0400 (Tue, 08 Sep 2009) | 2 lines
random weapon arena: switch gun after frag too
r7694 | div0 | 2009-09-08 10:44:25 -0400 (Tue, 08 Sep 2009) | 2 lines
add missing fdecl
r7695 | div0 | 2009-09-08 10:48:31 -0400 (Tue, 08 Sep 2009) | 2 lines
stupid stupid stupid ;)
r7696 | div0 | 2009-09-08 11:21:24 -0400 (Tue, 08 Sep 2009) | 2 lines
do not switch weapon after suicide (respawn will do anyway)
r7697 | mrbougo | 2009-09-08 12:10:52 -0400 (Tue, 08 Sep 2009) | 1 line
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
r7698 | div0 | 2009-09-08 15:24:10 -0400 (Tue, 08 Sep 2009) | 2 lines
random weapon arena: try to ensure the weapon ALWAYS changes on frag
Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/.patchsets 2009-09-11 08:50:19 UTC (rev 7728)
@@ -1,2 +1,2 @@
master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-7563,7565-7586,7589-7589,7592-7592,7595-7595,7597-7597,7599-7602,7605-7610,7612-7615,7619-7620,7623-7623,7626-7628,7630-7630,7644-7651,7656-7656,7658-7660,7663-7665,7670-7670,7672-7676,7678-7678,7680-7680,7686-7687,7689-7690
+revisions_applied = 1-7563,7565-7586,7589-7589,7592-7592,7595-7595,7597-7597,7599-7602,7605-7610,7612-7615,7619-7620,7623-7623,7626-7628,7630-7630,7644-7651,7656-7656,7658-7660,7663-7665,7670-7670,7672-7676,7678-7678,7680-7680,7686-7687,7689-7690,7693-7698
Modified: branches/nexuiz-2.0/data/defaultNexuiz.cfg
===================================================================
--- branches/nexuiz-2.0/data/defaultNexuiz.cfg 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/defaultNexuiz.cfg 2009-09-11 08:50:19 UTC (rev 7728)
@@ -1638,6 +1638,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 20 // less
seta cl_casings_maxcount 100 "maximum amount of shell casings (must be at least 1)"
Modified: branches/nexuiz-2.0/data/qcsrc/client/Main.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/Main.qc 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/client/Main.qc 2009-09-11 08:50:19 UTC (rev 7728)
@@ -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;
@@ -849,6 +859,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: branches/nexuiz-2.0/data/qcsrc/client/View.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/View.qc 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/client/View.qc 2009-09-11 08:50:19 UTC (rev 7728)
@@ -379,6 +379,13 @@
if(!postinit)
PostInit();
+ if(intermission && !isdemo() && !(calledhooks & HOOK_END))
+ if(calledhooks & HOOK_START)
+ {
+ localcmd("\ncl_hook_gameend;");
+ calledhooks |= HOOK_END;
+ }
+
CheckForGamestartChange();
maptimeAnnouncer();
Modified: branches/nexuiz-2.0/data/qcsrc/client/main.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/main.qh 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/client/main.qh 2009-09-11 08:50:19 UTC (rev 7728)
@@ -152,3 +152,8 @@
#define ALPHA_MIN_VISIBLE 0.003
float armorblockpercent;
+
+//hooks
+float calledhooks;
+#define HOOK_START 1
+#define HOOK_END 2
Modified: branches/nexuiz-2.0/data/qcsrc/server/builtins.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/builtins.qh 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/server/builtins.qh 2009-09-11 08:50:19 UTC (rev 7728)
@@ -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: branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc 2009-09-11 08:50:19 UTC (rev 7728)
@@ -850,7 +850,7 @@
}
if(g_weaponarena_random)
- self.weapons = randombits(self.weapons, g_weaponarena_random);
+ self.weapons = randombits(self.weapons, g_weaponarena_random, FALSE);
self.items = start_items;
self.switchweapon = w_getbestweapon(self);
Modified: branches/nexuiz-2.0/data/qcsrc/server/clientcommands.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/clientcommands.qc 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/server/clientcommands.qc 2009-09-11 08:50:19 UTC (rev 7728)
@@ -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: branches/nexuiz-2.0/data/qcsrc/server/g_damage.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_damage.qc 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_damage.qc 2009-09-11 08:50:19 UTC (rev 7728)
@@ -92,8 +92,11 @@
}
// NOTE: f=0 means still count as a (positive) kill, but count no frags for it
+void W_SwitchWeapon_Force(entity e, float w);
void GiveFrags (entity attacker, entity targ, float f)
{
+ float w;
+
// TODO route through PlayerScores instead
if(gameover) return;
@@ -122,6 +125,26 @@
if(cvar("g_arena_roundbased"))
return;
+ if(targ != attacker) // not for suicides
+ if(g_weaponarena_random)
+ {
+ // after a frag, choose another random weapon set
+ if(inWarmupStage)
+ w = warmup_start_weapons;
+ else
+ w = start_weapons;
+
+ attacker.weapons = randombits(w - (w & W_WeaponBit(attacker.weapon)), g_weaponarena_random, TRUE);
+ if(attacker.weapons < 0)
+ {
+ // error from randombits: no weapon available
+ // this means we can just give ALL weapons
+ attacker.weapons = w;
+ }
+ if not(attacker.weapons & W_WeaponBit(attacker.weapon))
+ W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker));
+ }
+
// FIXME fix the mess this is (we have REAL points now!)
if(g_runematch)
{
Modified: branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_world.qc 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_world.qc 2009-09-11 08:50:19 UTC (rev 7728)
@@ -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);
};
Modified: branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc 2009-09-11 08:48:29 UTC (rev 7727)
+++ branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc 2009-09-11 08:50:19 UTC (rev 7728)
@@ -2586,7 +2586,7 @@
return b;
}
-float randombits(float bits, float k)
+float randombits(float bits, float k, float error_return)
{
float r;
r = 0;
@@ -2595,6 +2595,9 @@
r += randombit(bits - r);
--k;
}
+ if(error_return)
+ if(k > 0)
+ return -1; // all
return r;
}
More information about the nexuiz-commits
mailing list