r3962 - in trunk/data: . qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Jul 28 06:02:34 EDT 2008
Author: div0
Date: 2008-07-28 06:02:33 -0400 (Mon, 28 Jul 2008)
New Revision: 3962
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/domination.qc
trunk/data/qcsrc/server/g_damage.qc
trunk/data/qcsrc/server/scores_rules.qc
Log:
add score rules for domination (maybe add more stuff later)
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2008-07-28 09:46:28 UTC (rev 3961)
+++ trunk/data/defaultNexuiz.cfg 2008-07-28 10:02:33 UTC (rev 3962)
@@ -445,7 +445,6 @@
set g_domination_default_teams 2 // default number of teams for maps that aren't domination-specific
set g_domination_disable_frags 0 // players can't get frags normally, only get points from kills
set g_domination_point_amt 0 // override: how many points to get per ping
-set g_domination_point_teamamt 0 // override: how many team points to get per ping
set g_domination_point_rate 0 // override: how often to give those points
set g_domination_point_capturetime 0.1 // how long it takes to capture a point (given no interference)
set g_domination_point_glow 0 // domination point glow (warning, slow)
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2008-07-28 09:46:28 UTC (rev 3961)
+++ trunk/data/qcsrc/server/cl_client.qc 2008-07-28 10:02:33 UTC (rev 3962)
@@ -1232,6 +1232,7 @@
// free cvars
GetCvars(-1);
+ self.playerid = 0;
}
.float BUTTON_CHAT;
Modified: trunk/data/qcsrc/server/domination.qc
===================================================================
--- trunk/data/qcsrc/server/domination.qc 2008-07-28 09:46:28 UTC (rev 3961)
+++ trunk/data/qcsrc/server/domination.qc 2008-07-28 10:02:33 UTC (rev 3962)
@@ -17,6 +17,8 @@
#define DOMPOINTFRAGS frags
+.float enemy_playerid;
+
void() dom_controlpoint_setup;
void LogDom(string mode, float team_before, entity actor)
@@ -102,8 +104,7 @@
{
local entity head;
local float waittime;
- local float teamfragamt;
- local float individualfragamt;
+ local float fragamt;
self.nextthink = time + 0.1;
@@ -126,39 +127,23 @@
// NOTE: this defaults to 0
if (self.goalentity.netname)
{
- teamfragamt = cvar("g_domination_point_teamamt");
- if(!teamfragamt)
- teamfragamt = self.DOMPOINTFRAGS;
- TeamScore_AddToTeam(self.goalentity.team, ST_DOM_DOMPOINTS, teamfragamt);
- }
+ fragamt = cvar("g_domination_point_amt");
+ if(!fragamt)
+ fragamt = self.DOMPOINTFRAGS;
+ TeamScore_AddToTeam(self.goalentity.team, ST_SCORE, fragamt);
+ TeamScore_AddToTeam(self.goalentity.team, ST_DOM_DOMTICKS, fragamt);
- // if the player left the game, changed teams or became spectator, we have to find another player on the same team to give credit to
- if (!self.enemy.flags || self.enemy.team != self.goalentity.team || self.enemy.killcount == -666) // flags is zero on removed clients
- {
- other = self.enemy;
- FOR_EACH_PLAYER(head)
- if (head.team == self.goalentity.team)
- self.enemy = head;
- if(self.enemy == other) // search returned no matching player, reset dom point
+ // give credit to the individual player, if he is still there
+ if (self.enemy.playerid == self.enemy_playerid)
{
- dom_controlpoint_setup();
- self.enemy = world;
- self.cnt = 0;
- self.aiment = world;
+ PlayerScore_Add(self.enemy, SP_SCORE, fragamt);
+ PlayerScore_Add(self.enemy, SP_DOM_DOMTICKS, fragamt);
}
+ else
+ self.enemy = world;
}
+}
- // give credit to the individual player
- if (self.enemy)
- {
- individualfragamt = cvar("g_domination_point_amt");
- if(!individualfragamt)
- individualfragamt = self.DOMPOINTFRAGS;
- UpdateFrags(self.enemy, individualfragamt);
- PlayerScore_Add(self.enemy, SP_DOM_DOMPOINTS, individualfragamt);
- }
-};
-
void dompointtouch()
{
local entity head;
@@ -200,6 +185,7 @@
self.skin = head.skin;
self.enemy = other; // individual player scoring
+ self.enemy_playerid = other.playerid;
dompoint_captured();
};
@@ -593,6 +579,8 @@
}
}
}
+
+ ScoreRules_dom();
};
void dom_init()
Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc 2008-07-28 09:46:28 UTC (rev 3961)
+++ trunk/data/qcsrc/server/g_damage.qc 2008-07-28 10:02:33 UTC (rev 3962)
@@ -76,14 +76,8 @@
PlayerScore_Add(targ, SP_DEATHS, 1);
// FIXME fix the mess this is (we have REAL points now!)
- if(g_domination)
+ if(g_runematch)
{
- if(cvar("g_domination_disable_frags"))
- if(f > 0)
- f = 0;
- }
- else if(g_runematch)
- {
f = RunematchHandleFrags(attacker, targ, f);
}
else if(g_keyhunt)
Modified: trunk/data/qcsrc/server/scores_rules.qc
===================================================================
--- trunk/data/qcsrc/server/scores_rules.qc 2008-07-28 09:46:28 UTC (rev 3961)
+++ trunk/data/qcsrc/server/scores_rules.qc 2008-07-28 10:02:33 UTC (rev 3962)
@@ -36,7 +36,7 @@
{
float sp_score, sp_caps;
sp_score = sp_caps = 0;
- switch(g_ctf_win_mode)
+ switch(cvar("g_ctf_win_mode"))
{
case 0: // caps only
sp_caps = SFL_SORT_PRIO_PRIMARY;
@@ -46,6 +46,7 @@
sp_score = SFL_SORT_PRIO_SECONDARY;
break;
case 2: // score only
+ default:
sp_score = SFL_SORT_PRIO_PRIMARY;
sp_caps = SFL_SORT_PRIO_SECONDARY; // looks better ;)
break;
@@ -61,8 +62,21 @@
}
// g_domination
-#define ST_DOM_DOMPOINTS 1
-#define SP_DOM_DOMPOINTS 4
+#define ST_DOM_DOMTICKS 1
+#define SP_DOM_DOMTICKS 4
+void ScoreRules_dom()
+{
+ float sp_domticks, sp_score;
+ sp_score = sp_domticks = 0;
+ if(cvar("g_domination_disable_frags"))
+ sp_domticks = SFL_SORT_PRIO_PRIMARY;
+ else
+ sp_score = SFL_SORT_PRIO_PRIMARY;
+ CheckAllowedTeams(world);
+ ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), sp_score);
+ ScoreInfo_SetLabel_TeamScore (ST_DOM_DOMTICKS, "domticks", sp_domticks);
+ ScoreInfo_SetLabel_PlayerScore(SP_DOM_DOMTICKS, "domticks", sp_domticks);
+}
// LMS stuff
#define SP_LMS_LIVES 4
More information about the nexuiz-commits
mailing list