From cbb2d662928264eab828c2e6756e897939dcbcfb Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 21 Jun 2011 19:21:05 +0200 Subject: [PATCH] waypointsprites: always add color to WaypointSprite_Spawn() --- qcsrc/common/constants.qh | 1 + qcsrc/server/cl_weaponsystem.qc | 3 ++- qcsrc/server/ctf.qc | 3 +-- qcsrc/server/mutators/gamemode_freezetag.qc | 6 +----- qcsrc/server/mutators/gamemode_keepaway.qc | 6 ++---- qcsrc/server/mutators/gamemode_keyhunt.qc | 3 +-- qcsrc/server/nexball.qc | 3 +-- qcsrc/server/t_items.qc | 6 +----- qcsrc/server/vehicles/vehicles.qc | 13 ++++++------- qcsrc/server/w_seeker.qc | 3 +-- qcsrc/server/waypointsprites.qc | 15 +++++++++------ 11 files changed, 26 insertions(+), 36 deletions(-) diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 4db7ea675..132021aa8 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -125,6 +125,7 @@ const float ENT_CLIENT_VEHICLE = 60; const float SPRITERULE_DEFAULT = 0; const float SPRITERULE_TEAMPLAY = 1; +const float RADARICON_NONE = 0; const float RADARICON_FLAG = 1; const float RADARICON_FLAGCARRIER = 1; const float RADARICON_HERE = 1; // TODO make these 3 and 4, and make images for them diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index 15894f6df..500132f0b 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -986,7 +986,8 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) world, e.origin, self, 0, world, enemy, - 0 + 0, + RADARICON_NONE, '0 0 0' ); } } diff --git a/qcsrc/server/ctf.qc b/qcsrc/server/ctf.qc index c3676ff45..27a81c8b1 100644 --- a/qcsrc/server/ctf.qc +++ b/qcsrc/server/ctf.qc @@ -296,8 +296,7 @@ void DropFlag(entity e, entity penalty_receiver, entity attacker) ctf_captureshield_update(p, 0); // shield only e.playerid = attacker.playerid; e.ctf_droptime = time; - WaypointSprite_Spawn("flagdropped", 0, 0, e, '0 0 1' * 61, world, COLOR_TEAM1 + COLOR_TEAM2 - e.team, e, waypointsprite_attachedforcarrier, FALSE); - WaypointSprite_UpdateTeamRadar(e.waypointsprite_attachedforcarrier, RADARICON_FLAG, '0 1 1'); + WaypointSprite_Spawn("flagdropped", 0, 0, e, '0 0 1' * 61, world, COLOR_TEAM1 + COLOR_TEAM2 - e.team, e, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAG, '0 1 1'); WaypointSprite_Ping(e.waypointsprite_attachedforcarrier); if(p.waypointsprite_attachedforcarrier) diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index f56dc59f1..c3d927259 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -88,11 +88,7 @@ void freezetag_Freeze(entity attacker) RemoveGrapplingHook(self); // add waypoint - WaypointSprite_Spawn("freezetag_frozen", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attached, TRUE); - if(self.waypointsprite_attached) - { - WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_WAYPOINT, '0.25 0.90 1'); - } + WaypointSprite_Spawn("freezetag_frozen", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attached, TRUE, RADARICON_WAYPOINT, '0.25 0.90 1'); if(attacker == self) { diff --git a/qcsrc/server/mutators/gamemode_keepaway.qc b/qcsrc/server/mutators/gamemode_keepaway.qc index 1d091b115..6ec91706b 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -75,8 +75,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1); pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1); - WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE); - WaypointSprite_UpdateTeamRadar(self.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '0 1 1'); + WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1'); WaypointSprite_Ping(self.waypointsprite_attachedforcarrier); sound(self, CHAN_AUTO, "keepaway/respawn.wav", VOL_BASE, ATTN_NONE); // ATTN_NONE (it's a sound intended to be heard anywhere) @@ -178,9 +177,8 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los // PlayerScore_Add(plyr, SP_KEEPAWAY_DROPS, 1); Not anymore, this is 100% the same as pickups and is useless. // waypoints - WaypointSprite_Spawn("ka-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE); + WaypointSprite_Spawn("ka-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1'); WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); - WaypointSprite_UpdateTeamRadar(ball.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '0 1 1'); WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier); WaypointSprite_Kill(plyr.waypointsprite_attachedforcarrier); } diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index 85623f79d..5a5edcc28 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -751,9 +751,8 @@ void kh_Key_Spawn(entity initial_owner, float angle, float i) // runs every tim centerprint(initial_owner, strcat("You are starting with the ", key.netname, "\n")); // message to player at start of round - WaypointSprite_Spawn("key-dropped", 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, FALSE); + WaypointSprite_Spawn("key-dropped", 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAG, '0 1 1'); key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player; - WaypointSprite_UpdateTeamRadar(key.waypointsprite_attachedforcarrier, RADARICON_FLAG, '0 1 1'); kh_Key_AssignTo(key, initial_owner); } diff --git a/qcsrc/server/nexball.qc b/qcsrc/server/nexball.qc index 13e8eea40..57bbc531e 100644 --- a/qcsrc/server/nexball.qc +++ b/qcsrc/server/nexball.qc @@ -202,9 +202,8 @@ void DropBall (entity ball, vector org, vector vel) WaypointSprite_Kill(ball.owner.waypointsprite_attachedforcarrier); //WaypointSprite_AttachCarrier("nb-ball", ball); - WaypointSprite_Spawn("nb-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE); // no health bar please + WaypointSprite_Spawn("nb-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); // no health bar please WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); - WaypointSprite_UpdateTeamRadar(ball.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); ball.owner.ballcarried = world; ball.owner = world; diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 5a591e035..02660fc52 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -198,13 +198,9 @@ void Item_RespawnCountdown (void) } if(name) { - WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE); + WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb); if(self.waypointsprite_attached) - { - WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, rgb); - //WaypointSprite_UpdateMaxHealth(self.waypointsprite_attached, ITEM_RESPAWN_TICKS + 1); WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS); - } } } sound (self, CHAN_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTN_NORM); // play respawn sound diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index 820c2ecbd..db22ae42a 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -785,6 +785,7 @@ void vehicles_showwp_goaway() void vehicles_showwp() { entity oldself; + vector rgb; if(self.cnt) { @@ -807,18 +808,16 @@ void vehicles_showwp() self.think = vehicles_showwp_goaway; } - WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE); + if(teamplay && self.team) + rgb = TeamColor(self.team); + else + rgb = '1 1 1'; + WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb); if(self.waypointsprite_attached) { - if(teamplay && self.team) - WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, TeamColor(self.team)); - else - WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, '1 1 1'); - WaypointSprite_UpdateRule(self.waypointsprite_attached, self.enemy.team, SPRITERULE_DEFAULT); if(oldself == world) WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink); - WaypointSprite_Ping(self.waypointsprite_attached); } diff --git a/qcsrc/server/w_seeker.qc b/qcsrc/server/w_seeker.qc index 890363da6..74ac14550 100644 --- a/qcsrc/server/w_seeker.qc +++ b/qcsrc/server/w_seeker.qc @@ -454,8 +454,7 @@ void Seeker_Tag_Touch() if (autocvar_g_balance_seeker_type == 1) { - WaypointSprite_Spawn("tagged-target", autocvar_g_balance_seeker_tag_tracker_lifetime, 0, other, '0 0 64', self.owner, 0, other, wps_tag_tracker, TRUE); - WaypointSprite_UpdateTeamRadar(other.wps_tag_tracker, RADARICON_TAGGED, '0.5 1 0'); + WaypointSprite_Spawn("tagged-target", autocvar_g_balance_seeker_tag_tracker_lifetime, 0, other, '0 0 64', self.owner, 0, other, wps_tag_tracker, TRUE, RADARICON_TAGGED, '0.5 1 0'); WaypointSprite_UpdateRule(other.wps_tag_tracker, 0, SPRITERULE_DEFAULT); } } diff --git a/qcsrc/server/waypointsprites.qc b/qcsrc/server/waypointsprites.qc index 24fdcb336..e794c29d3 100644 --- a/qcsrc/server/waypointsprites.qc +++ b/qcsrc/server/waypointsprites.qc @@ -299,7 +299,8 @@ entity WaypointSprite_Spawn( entity ref, vector ofs, // position entity showto, float t, // show to whom? Use a flag to indicate a team entity own, .entity ownfield, // remove when own gets killed - float hideable // true when it should be controlled by cl_hidewaypoints + float hideable, // true when it should be controlled by cl_hidewaypoints + float icon, vector rgb // initial icon and color ) { entity wp; @@ -333,6 +334,8 @@ entity WaypointSprite_Spawn( wp.customizeentityforclient = WaypointSprite_Customize; wp.waypointsprite_visible_for_player = WaypointSprite_visible_for_player; wp.reset2 = WaypointSprite_Reset; + wp.cnt = icon; + wp.colormod = rgb; Net_LinkEntity(wp, FALSE, 0, WaypointSprite_SendEntity); return wp; } @@ -344,7 +347,7 @@ entity WaypointSprite_SpawnFixed( .entity ownfield ) { - return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, own, ownfield, TRUE); + return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, own, ownfield, TRUE, 0, '0 0 0'); } .entity waypointsprite_deployed_fixed; @@ -363,7 +366,7 @@ entity WaypointSprite_DeployFixed( maxdistance = waypointsprite_limitedrange; else maxdistance = 0; - return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, world, ofs, world, t, self, waypointsprite_deployed_fixed, FALSE); + return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, world, ofs, world, t, self, waypointsprite_deployed_fixed, FALSE, RADARICON_NONE, '0 0 0'); } .entity waypointsprite_deployed_personal; @@ -372,7 +375,7 @@ entity WaypointSprite_DeployPersonal( vector ofs ) { - return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, FALSE); + return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, FALSE, 0, '0 0 0'); } .entity waypointsprite_attached; @@ -393,7 +396,7 @@ entity WaypointSprite_Attach( maxdistance = waypointsprite_limitedrange; else maxdistance = 0; - return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, self, '0 0 64', world, t, self, waypointsprite_attached, FALSE); + return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, self, '0 0 64', world, t, self, waypointsprite_attached, FALSE, RADARICON_NONE, '0 0 0'); } entity WaypointSprite_AttachCarrier( @@ -403,7 +406,7 @@ entity WaypointSprite_AttachCarrier( { entity e; WaypointSprite_Kill(carrier.waypointsprite_attached); // FC overrides attached - e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, FALSE); + e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, FALSE, RADARICON_NONE, '0 0 0'); if(e) { WaypointSprite_UpdateMaxHealth(e, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent) * 2); -- 2.39.2