]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implementing several new waypointsprite features (like time limits until enemy flag...
authorSamual <samual@xonotic.org>
Mon, 2 Apr 2012 01:45:11 +0000 (21:45 -0400)
committerSamual <samual@xonotic.org>
Mon, 2 Apr 2012 01:45:11 +0000 (21:45 -0400)
defaultXonotic.cfg
qcsrc/client/waypointsprites.qc
qcsrc/server/autocvars.qh
qcsrc/server/cl_impulse.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh

index f471d449c36b0bf0e8e80419629040fc5bb028f2..ad574606cfa301d35c9f616d3f60f67117c804ec 100644 (file)
@@ -599,6 +599,9 @@ set g_ctf_flagcarrier_selfdamagefactor 1
 set g_ctf_flagcarrier_selfforcefactor 1
 set g_ctf_flagcarrier_damagefactor 1
 set g_ctf_flagcarrier_forcefactor 1
+//set g_ctf_flagcarrier_waypoint 1 "show a waypointsprite marking the flagcarriers location"
+set g_ctf_flagcarrier_waypointforenemy_time 5 "show the enemy flagcarrier location after this time period is up"
+set g_ctf_flagcarrier_waypointforenemy_spotting 1 "show the enemy flagcarrier location if a team mate presses +use to spot them"
 set g_ctf_dropped_capture_radius 100 "allow dropped flags to be automatically captured by base flags if the dropped flag is within this radius of it"
 set g_ctf_fullbrightflags 0
 set g_ctf_dynamiclights 0
index 78ddc8b793c22f4b080100ace1df2a94538979be..2d0887ef9c6a75792462d5c1268cbc85ed98bfe5 100644 (file)
@@ -256,6 +256,7 @@ string spritelookuptext(string s)
                case "as-defend": return _("Defend");
                case "bluebase": return _("Blue base");
                case "danger": return _("DANGER");
+               case "enemyflagcarrier": return _("Enemy flag carrier");
                case "flagcarrier": return _("Flag carrier");
                case "flagdropped": return _("Dropped flag");
                case "helpme": return _("Help me!");
index d0950bcc929245596ba201cc38dfe9f302858cb6..cf5e9a3ebbb67133fb98d32ffd54ca21f7febcb2 100644 (file)
@@ -792,6 +792,8 @@ float autocvar_g_ctf_flagcarrier_selfdamagefactor;
 float autocvar_g_ctf_flagcarrier_selfforcefactor;
 float autocvar_g_ctf_flagcarrier_damagefactor;
 float autocvar_g_ctf_flagcarrier_forcefactor;
+float autocvar_g_ctf_flagcarrier_waypointforenemy_time;
+float autocvar_g_ctf_flagcarrier_waypointforenemy_spotting;
 float autocvar_g_ctf_fullbrightflags;
 float autocvar_g_ctf_ignore_frags;
 float autocvar_g_ctf_shield_force;
index 524e796af2e32859054ee3a82522eae1ddb85147..de7da012a789446cfe4aabca9b9a573fbbc9ed7b 100644 (file)
@@ -161,7 +161,7 @@ void ImpulseCommands (void)
                                {
                                        wp = WaypointSprite_Attach("helpme", TRUE, RADARICON_HELPME, '1 0.5 0');
                                        if(!wp)
-                                               WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
+                                               WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier); // FIXCTF
                                        else
                                                WaypointSprite_Ping(wp);
                                        sprint(self, "HELP ME attached\n");
index 721407f4554350156f8def992ab5b78a9e2ccc9a..caabb018c59e34b4a82a9122551993467fa2d073 100644 (file)
@@ -62,10 +62,10 @@ string ctf_CaptureRecord(entity flag, entity player)
 
 void ctf_FlagcarrierWaypoints(entity player)
 {
-       WaypointSprite_Spawn("flagcarrier", 0, 0, player, '0 0 64', world, player.team, player, wps_flagcarrier, FALSE, RADARICON_FLAG, '1 1 0');
+       WaypointSprite_Spawn("flagcarrier", 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_FLAGCARRIER(player.team));
        WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent) * 2);
        WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent));
-       WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, '1 1 0');
+       WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, WPCOLOR_FLAGCARRIER(player.team));
 }
 
 
@@ -189,7 +189,7 @@ void ctf_Handle_Drop(entity flag, entity player, float droptype)
        
        // waypoints
        if(autocvar_g_ctf_flag_dropped_waypoint)
-               WaypointSprite_Spawn("flagdropped", 0, 0, flag, '0 0 64', world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, FALSE, RADARICON_FLAG, '0 0.5 0' + ((flag.team == COLOR_TEAM1) ? '0.75 0 0' : '0 0 0.75')); // (COLOR_TEAM1 + COLOR_TEAM2 - flag.team)
+               WaypointSprite_Spawn("flagdropped", 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, TRUE, RADARICON_FLAG, WPCOLOR_DROPPEDFLAG(flag.team));
 
        if(autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health))
        {
@@ -332,6 +332,9 @@ void ctf_Handle_Throw(entity player, entity reciever, float droptype)
        WaypointSprite_Ping(player.wps_flagcarrier);
        WaypointSprite_Kill(player.wps_flagcarrier);
        
+       if(player.wps_enemyflagcarrier)
+                       WaypointSprite_Kill(player.wps_enemyflagcarrier);
+       
        // captureshield
        //ctf_CaptureShield_Update(player, 0); // shield only
 }
@@ -394,7 +397,7 @@ void ctf_Handle_Return(entity flag, entity player)
        PlayerTeamScore_AddScore(player, ctf_ReadScore("score_return")); // reward for return
        PlayerScore_Add(player, SP_CTF_RETURNS, 1); // add to count of returns
 
-       TeamScore_AddToTeam(((flag.team == COLOR_TEAM1) ? COLOR_TEAM2 : COLOR_TEAM1), ST_SCORE, -ctf_ReadScore("penalty_returned")); // punish the team who was last carrying it
+       TeamScore_AddToTeam(flag.ctf_dropper.team, ST_SCORE, -ctf_ReadScore("penalty_returned")); // punish the team who was last carrying it
        FOR_EACH_PLAYER(player) if(player == flag.ctf_dropper) // punish the player who dropped the flag
        {
                PlayerScore_Add(player, SP_SCORE, -ctf_ReadScore("penalty_returned"));
@@ -503,7 +506,7 @@ void ctf_CheckFlagReturn(entity flag)
 {
        if(flag.wps_flagdropped) { WaypointSprite_UpdateHealth(flag.wps_flagdropped, flag.health); }
        
-       if((flag.health <= 0) || (time > flag.ctf_droptime + autocvar_g_ctf_flag_return_time))
+       if((flag.health <= 0) || (time >= flag.ctf_droptime + autocvar_g_ctf_flag_return_time))
        {
                bprint("The ", flag.netname, " has returned to base\n");
                sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTN_NONE);
@@ -568,7 +571,7 @@ void ctf_FlagThink()
                {
                        if(autocvar_g_ctf_flag_return_dropped)
                        {
-                               if((vlen(self.origin - self.ctf_spawnorigin) < autocvar_g_ctf_flag_return_dropped) || (autocvar_g_ctf_flag_return_dropped == -1))
+                               if((vlen(self.origin - self.ctf_spawnorigin) <= autocvar_g_ctf_flag_return_dropped) || (autocvar_g_ctf_flag_return_dropped == -1))
                                {
                                        self.health = 0;
                                        ctf_CheckFlagReturn(self);
@@ -586,7 +589,7 @@ void ctf_FlagThink()
                        
                case FLAG_CARRY:
                {
-                       if((self.owner) && (self.speedrunning) && (ctf_captimerecord) && (time >= self.ctf_pickuptime + ctf_captimerecord)) 
+                       if(self.speedrunning && ctf_captimerecord && (time >= self.ctf_pickuptime + ctf_captimerecord)) 
                        {
                                bprint("The ", self.netname, " became impatient after ", ftos_decimals(ctf_captimerecord, 2), " seconds and returned itself\n");
                                sound(self, CH_TRIGGER, self.snd_flag_respawn, VOL_BASE, ATTN_NONE);
@@ -599,6 +602,16 @@ void ctf_FlagThink()
                                ImpulseCommands();
                                self = tmp_entity;
                        }
+                       
+                       if(autocvar_g_ctf_flagcarrier_waypointforenemy_time)
+                       if((time >= self.ctf_pickuptime + autocvar_g_ctf_flagcarrier_waypointforenemy_time) && !self.owner.wps_enemyflagcarrier)
+                       {
+                               WaypointSprite_Spawn("enemyflagcarrier", 0, 0, self.owner, FLAG_WAYPOINT_OFFSET, world, self.team, self.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(self.owner.team));
+                               
+                               FOR_EACH_PLAYER(tmp_entity)
+                                       centerprint(tmp_entity, strcat(self.owner.netname, " held on to the ", self.netname, " for ", ftos(autocvar_g_ctf_flagcarrier_waypointforenemy_time), " seconds"));
+                       }
+                                       
                        return;
                }
                
@@ -707,7 +720,11 @@ void ctf_RespawnFlag(entity flag)
        // reset the player (if there is one)
        if((flag.owner) && (flag.owner.flagcarried == flag))
        {
+               if(flag.owner.wps_enemyflagcarrier)
+                       WaypointSprite_Kill(flag.owner.wps_enemyflagcarrier);
+                       
                WaypointSprite_Kill(flag.wps_flagcarrier);
+               
                flag.owner.flagcarried = world;
 
                if(flag.speedrunning)
@@ -759,8 +776,8 @@ void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf
        self.bot_basewaypoint = self.nearestwaypoint;
 
        // waypointsprites
-       WaypointSprite_SpawnFixed(((teamnumber) ? "redbase" : "bluebase"), self.origin + '0 0 64', self, wps_flagbase, RADARICON_FLAG, colormapPaletteColor(((teamnumber) ? COLOR_TEAM1 : COLOR_TEAM2) - 1, FALSE));
-       WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, colormapPaletteColor(((teamnumber) ? COLOR_TEAM1 : COLOR_TEAM2) - 1, FALSE));
+       WaypointSprite_SpawnFixed(((teamnumber) ? "redbase" : "bluebase"), self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
+       WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
 
        // captureshield setup
        ctf_CaptureShield_Spawn(self);
index 8ac10bbf940f356579eccd2a99e889219985d75e..79562dafd532e80c893829f28c63cd9b29009909 100644 (file)
@@ -31,6 +31,11 @@ void spawnfunc_ctf_team();
 #define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13))
 #define FLAG_WAYPOINT_OFFSET ('0 0 64')
 
+// waypoint colors
+#define WPCOLOR_ENEMYFC(t) (colormapPaletteColor(t - 1, FALSE) * 0.6)
+#define WPCOLOR_FLAGCARRIER(t) (('0 0.75 0' + colormapPaletteColor(t - 1, FALSE)) * 0.25)
+#define WPCOLOR_DROPPEDFLAG(t) (('0.25 0.25 0.25' + colormapPaletteColor(t - 1, FALSE)) * 0.5)
+
 // sounds 
 .string noise4;
 .string noise5;
@@ -51,6 +56,7 @@ entity ctf_worldflaglist;
 .entity wps_flagbase; 
 .entity wps_flagcarrier;
 .entity wps_flagdropped;
+.entity wps_enemyflagcarrier;
 
 // statuses
 #define FLAG_BASE 1