From 3cc2f37092129be173109ef4c47d765945e94b7a Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 24 Aug 2015 21:34:10 +1000 Subject: [PATCH] Create waypoint definitions --- qcsrc/common/monsters/sv_monsters.qc | 4 +- qcsrc/common/mutators/all.inc | 2 +- .../common/mutators/mutator/waypoints/all.inc | 68 +++++++++ .../common/mutators/mutator/waypoints/all.qh | 35 +++++ .../{ => waypoints}/waypointsprites.qc | 136 ++++++------------ .../{ => waypoints}/waypointsprites.qh | 31 ++-- qcsrc/common/vehicles/sv_vehicles.qc | 9 +- qcsrc/common/weapons/w_seeker.qc | 2 +- qcsrc/server/cl_client.qc | 2 +- qcsrc/server/cl_impulse.qc | 20 +-- qcsrc/server/g_damage.qc | 2 +- qcsrc/server/mutators/gamemode_assault.qc | 6 +- qcsrc/server/mutators/gamemode_ctf.qc | 31 ++-- qcsrc/server/mutators/gamemode_ctf.qh | 2 +- qcsrc/server/mutators/gamemode_domination.qc | 16 +-- qcsrc/server/mutators/gamemode_keepaway.qc | 6 +- qcsrc/server/mutators/gamemode_keyhunt.qc | 29 ++-- qcsrc/server/mutators/gamemode_nexball.qc | 9 +- qcsrc/server/mutators/gamemode_nexball.qh | 1 - qcsrc/server/mutators/gamemode_onslaught.qc | 29 ++-- qcsrc/server/mutators/mutator_buffs.qc | 3 +- qcsrc/server/race.qc | 16 +-- qcsrc/server/t_items.qc | 44 ++---- qcsrc/server/weapons/selection.qc | 7 +- 24 files changed, 285 insertions(+), 225 deletions(-) create mode 100644 qcsrc/common/mutators/mutator/waypoints/all.inc create mode 100644 qcsrc/common/mutators/mutator/waypoints/all.qh rename qcsrc/common/mutators/mutator/{ => waypoints}/waypointsprites.qc (89%) rename qcsrc/common/mutators/mutator/{ => waypoints}/waypointsprites.qh (93%) diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 249e6f97e..6a3553b1c 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1144,7 +1144,9 @@ float monster_spawn() MonsterSound(monstersound_spawn, 0, false, CH_VOICE); - WaypointSprite_Spawn(M_NAME(self.monsterid), 0, 1024, self, '0 0 1' * (self.maxs.z + 15), world, self.team, self, sprite, true, RADARICON_DANGER, ((self.team) ? Team_ColorRGB(self.team) : '1 0 0')); + entity wp = WaypointSprite_Spawn(WP_Monster, 0, 1024, self, '0 0 1' * (self.maxs.z + 15), world, self.team, self, sprite, true, RADARICON_DANGER); + wp.wp_extra = self.monsterid; + wp.colormod = ((self.team) ? Team_ColorRGB(self.team) : '1 0 0'); if(!(self.spawnflags & MONSTERFLAG_INVINCIBLE)) { WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health); diff --git a/qcsrc/common/mutators/all.inc b/qcsrc/common/mutators/all.inc index 0471dff7c..ffdc453f1 100644 --- a/qcsrc/common/mutators/all.inc +++ b/qcsrc/common/mutators/all.inc @@ -1,3 +1,3 @@ #include "mutator/damagetext.qc" #include "mutator/itemstime.qc" -#include "mutator/waypointsprites.qc" +#include "mutator/waypoints/waypointsprites.qc" diff --git a/qcsrc/common/mutators/mutator/waypoints/all.inc b/qcsrc/common/mutators/mutator/waypoints/all.inc new file mode 100644 index 000000000..e1153c2b8 --- /dev/null +++ b/qcsrc/common/mutators/mutator/waypoints/all.inc @@ -0,0 +1,68 @@ +/** If you register a new waypoint, make sure to add it to this list */ +REGISTER_WAYPOINT(, "", '0 0 0', 1); +#define WP_Null WP_ + +REGISTER_WAYPOINT(Waypoint, _("Waypoint"), '0 1 1', 1); +REGISTER_WAYPOINT(Helpme, _("Help me!"), '1 0.5 0', 1); +REGISTER_WAYPOINT(Here, _("Here"), '0 1 0', 1); +REGISTER_WAYPOINT(Danger, _("DANGER"), '1 0.5 0', 1); + +REGISTER_WAYPOINT(Frozen, _("Frozen!"), '0.25 0.90 1', 1); + +REGISTER_WAYPOINT(Item, _("Item"), '1 0 1', 1); + +REGISTER_WAYPOINT(RaceCheckpoint, _("Checkpoint"), '1 0.5 0', 1); +REGISTER_WAYPOINT(RaceFinish, _("Finish"), '1 0.5 0', 1); +REGISTER_WAYPOINT(RaceStart, _("Start"), '1 0.5 0', 1); +REGISTER_WAYPOINT(RaceStartFinish, _("Start"), '1 0.5 0', 1); + +REGISTER_WAYPOINT(Assault, _(""), '1 0.5 0', 1); +REGISTER_WAYPOINT(AssaultDefend, _("Defend"), '1 0.5 0', 1); +REGISTER_WAYPOINT(AssaultDestroy, _("Destroy"), '1 0.5 0', 1); +REGISTER_WAYPOINT(AssaultPush, _("Push"), '1 0.5 0', 1); + +REGISTER_WAYPOINT(FlagCarrier, _("Flag carrier"), '0.8 0.8 0', 1); +REGISTER_WAYPOINT(FlagCarrierEnemy, _("Enemy carrier"), '1 1 1', 1); +REGISTER_WAYPOINT(FlagDropped, _("Dropped flag"), '1 1 1', 1); +REGISTER_WAYPOINT(FlagBaseNeutral, _("White base"), '0.8 0.8 0', 1); +REGISTER_WAYPOINT(FlagBaseRed, _("Red base"), '0.8 0.8 0', 1); +REGISTER_WAYPOINT(FlagBaseBlue, _("Blue base"), '0.8 0.8 0', 1); +REGISTER_WAYPOINT(FlagBaseYellow, _("Yellow base"), '0.8 0.8 0', 1); +REGISTER_WAYPOINT(FlagBasePink, _("Pink base"), '0.8 0.8 0', 1); + +REGISTER_WAYPOINT(DomNeut, _("Control point"), '0 1 1', 1); +REGISTER_WAYPOINT(DomRed, _("Control point"), '0 1 1', 1); +REGISTER_WAYPOINT(DomBlue, _("Control point"), '0 1 1', 1); +REGISTER_WAYPOINT(DomYellow, _("Control point"), '0 1 1', 1); +REGISTER_WAYPOINT(DomPink, _("Control point"), '0 1 1', 1); + +REGISTER_WAYPOINT(KeyDropped, _("Dropped key"), '0 1 1', 1); +REGISTER_WAYPOINT(KeyCarrierFriend, _("Key carrier"), '0 1 0', 1); +REGISTER_WAYPOINT(KeyCarrierFinish, _("Run here"), '0 1 1', 1); +REGISTER_WAYPOINT(KeyCarrierRed, _("Key carrier"), '0 1 1', 1); +REGISTER_WAYPOINT(KeyCarrierBlue, _("Key carrier"), '0 1 1', 1); +REGISTER_WAYPOINT(KeyCarrierYellow, _("Key carrier"), '0 1 1', 1); +REGISTER_WAYPOINT(KeyCarrierPink, _("Key carrier"), '0 1 1', 1); + +REGISTER_WAYPOINT(KaBall, _("Ball"), '0 1 1', 1); +REGISTER_WAYPOINT(KaBallCarrier, _("Ball carrier"), '1 0 0', 1); + +REGISTER_WAYPOINT(NbBall, _("Ball"), '0.91 0.85 0.62', 1); +REGISTER_WAYPOINT(NbGoal, _("Goal"), '1 0.5 0', 1); + +REGISTER_WAYPOINT(OnsCP, _("Control point"), '1 0.5 0', 1); +REGISTER_WAYPOINT(OnsCPDefend, _("Control point"), '1 0.5 0', 0.5); +REGISTER_WAYPOINT(OnsCPAttack, _("Control point"), '1 0.5 0', 2); +REGISTER_WAYPOINT(OnsGen, _("Generator"), '1 0.5 0', 1); +REGISTER_WAYPOINT(OnsGenShielded, _("Generator"), '1 0.5 0', 1); + +REGISTER_WAYPOINT(Buff, _("Buff"), '1 0.5 0', 1); + +REGISTER_WAYPOINT(Weapon, _("Weapon"), '0 0 0', 1); + +REGISTER_WAYPOINT(Monster, _("Monster"), '1 0 0', 1); + +REGISTER_WAYPOINT(Vehicle, _("Vehicle"), '1 1 1', 1); +REGISTER_WAYPOINT(VehicleIntruder, _("Intruder!"), '1 1 1', 1); + +REGISTER_WAYPOINT(Seeker, _("Tagged"), '0.5 1 0', 2); diff --git a/qcsrc/common/mutators/mutator/waypoints/all.qh b/qcsrc/common/mutators/mutator/waypoints/all.qh new file mode 100644 index 000000000..9670a6f38 --- /dev/null +++ b/qcsrc/common/mutators/mutator/waypoints/all.qh @@ -0,0 +1,35 @@ +#include "../../../registry.qh" + +#ifndef WAYPOINTS_ALL_H +#define WAYPOINTS_ALL_H + +#include "waypointsprites.qh" + +void RegisterWaypoints(); +const int MAX_WAYPOINTS = 240; +entity WAYPOINTS[MAX_WAYPOINTS], WAYPOINTS_first, WAYPOINTS_last; +int WAYPOINT_COUNT; +/** If you register a new waypoint, make sure to add it to all.inc */ +#define REGISTER_WAYPOINT_(id, init) REGISTER(RegisterWaypoints, WP, WAYPOINTS, WAYPOINT_COUNT, id, m_id, init) +REGISTER_REGISTRY(RegisterWaypoints) + +CLASS(Waypoint, Object) + ATTRIB(Waypoint, m_id, int, 0) + ATTRIB(Waypoint, netname, string, string_null) + ATTRIB(Waypoint, m_name, string, string_null) + ATTRIB(Waypoint, m_color, vector, '1 1 1') + ATTRIB(Waypoint, m_blink, int, 1) + CONSTRUCTOR(Waypoint, string _netname, string _name, vector _color, int _blink) { + CONSTRUCT(Waypoint); + this.netname = _netname; + this.m_name = _name; + this.m_color = _color; + this.m_blink = _blink; + } +ENDCLASS(Waypoint) + +#define REGISTER_WAYPOINT(id, text, color, blink) REGISTER_WAYPOINT_(id, NEW(Waypoint, #id, text, color, blink)) + +#include "all.inc" + +#endif diff --git a/qcsrc/common/mutators/mutator/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc similarity index 89% rename from qcsrc/common/mutators/mutator/waypointsprites.qc rename to qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 18d00518e..c5fa1ac00 100644 --- a/qcsrc/common/mutators/mutator/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -16,6 +16,7 @@ float WaypointSprite_SendEntity(entity to, float sendflags) sendflags |= 0x80; WriteByte(MSG_ENTITY, sendflags); + WriteByte(MSG_ENTITY, self.wp_extra); if (sendflags & 0x80) { @@ -127,6 +128,7 @@ void Ent_RemoveWaypointSprite() void Ent_WaypointSprite() { int sendflags = ReadByte(); + self.wp_extra = ReadByte(); if (!self.spawntime) self.spawntime = time; @@ -231,100 +233,47 @@ void Ent_WaypointSprite() #ifdef CSQC float spritelookupblinkvalue(string s) { - if (substring(s, 0, 4) == "wpn-") - if (get_weaponinfo(stof(substring(s, 4, strlen(s)))).spawnflags & WEP_FLAG_SUPERWEAPON) - return 2; - - FOREACH(ITEMS, it.m_waypoint == s, LAMBDA( - return it.m_waypointblink; - )); + if (s == WP_Weapon.netname) { + if (get_weaponinfo(self.wp_extra).spawnflags & WEP_FLAG_SUPERWEAPON) + return 2; + } + if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_waypointblink; switch (s) { - case "ons-cp-atck": return 2; - case "ons-cp-dfnd": return 0.5; case "item-invis": return 2; case "item-extralife": return 2; case "item-speed": return 2; - case "tagged-target": return 2; default: return 1; } } vector spritelookupcolor(string s, vector def) { - if (substring(s, 0, 4) == "wpn-") - return (get_weaponinfo(stof(substring(s, 4, strlen(s)))).wpcolor); - - switch (s) - { - case "keycarrier-friend": return '0 1 0'; - default: return def; - } + if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).wpcolor; + if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_color; + if (s == WP_Buff.netname) return BUFFS[self.wp_extra].m_color; + return def; } string spritelookuptext(string s) { - if (substring(s, 0, 4) == "wpn-") { return (get_weaponinfo(stof(substring(s, 4, strlen(s)))).message); } - if (substring(s, 0, 5) == "buff-") - { - entity buff = BUFF_NULL; - FOREACH(BUFFS, it.m_sprite == s, LAMBDA( - buff = it; - break; - )); - return buff.m_prettyName; - } + if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start"); + if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).message; + if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_waypoint; + if (s == WP_Buff.netname) return BUFFS[self.wp_extra].m_prettyName; + if (s == WP_Monster.netname) return get_monsterinfo(self.wp_extra).monster_name; + + // need to loop, as our netname could be one of three + FOREACH(WAYPOINTS, it.netname == s, LAMBDA( + return it.m_name; + )); switch (s) { - case "as-push": return _("Push"); - case "as-destroy": return _("Destroy"); - case "as-defend": return _("Defend"); - case "bluebase": return _("Blue base"); - case "danger": return _("DANGER"); - case "enemyflagcarrier": return _("Enemy carrier"); - case "flagcarrier": return _("Flag carrier"); - case "flagdropped": return _("Dropped flag"); - case "helpme": return _("Help me!"); - case "here": return _("Here"); - case "key-dropped": return _("Dropped key"); - case "keycarrier-blue": return _("Key carrier"); - case "keycarrier-finish": return _("Run here"); - case "keycarrier-friend": return _("Key carrier"); - case "keycarrier-pink": return _("Key carrier"); - case "keycarrier-red": return _("Key carrier"); - case "keycarrier-yellow": return _("Key carrier"); - case "redbase": return _("Red base"); - case "yellowbase": return _("Yellow base"); - case "neutralbase": return _("White base"); - case "pinkbase": return _("Pink base"); - case "waypoint": return _("Waypoint"); - case "ons-gen": return _("Generator"); - case "ons-gen-shielded": return _("Generator"); - case "ons-cp": return _("Control point"); - case "ons-cp-atck": return _("Control point"); - case "ons-cp-dfnd": return _("Control point"); - case "race-checkpoint": return _("Checkpoint"); - case "race-finish": return _("Finish"); - case "race-start": return _("Start"); - case "race-start-finish": return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start"); - case "goal": return _("Goal"); - case "nb-ball": return _("Ball"); - case "ka-ball": return _("Ball"); - case "ka-ballcarrier": return _("Ball carrier"); - case "dom-neut": return _("Control point"); - case "dom-red": return _("Control point"); - case "dom-blue": return _("Control point"); - case "dom-yellow": return _("Control point"); - case "dom-pink": return _("Control point"); case "item-invis": return _("Invisibility"); case "item-extralife": return _("Extra life"); case "item-speed": return _("Speed"); - case "frozen": return _("Frozen!"); - case "tagged-target": return _("Tagged"); - case "vehicle": return _("Vehicle"); - case "intruder": return _("Intruder!"); default: return s; } } @@ -820,8 +769,11 @@ void WaypointSprite_Load() #endif #ifdef SVQC -void WaypointSprite_UpdateSprites(entity e, string m1, string m2, string m3) +void WaypointSprite_UpdateSprites(entity e, entity _m1, entity _m2, entity _m3) { + string m1 = _m1.netname; + string m2 = _m2.netname; + string m3 = _m3.netname; if (m1 != e.model1) { e.model1 = m1; @@ -1055,13 +1007,13 @@ void WaypointSprite_Reset() } entity WaypointSprite_Spawn( - string spr, // sprite + entity spr, // sprite float _lifetime, float maxdistance, // lifetime, max distance 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 icon, vector rgb // initial icon and color + float icon // initial icon ) { entity wp = new(sprite_waypoint); @@ -1089,32 +1041,32 @@ entity WaypointSprite_Spawn( wp.fade_rate = maxdistance; wp.think = WaypointSprite_Think; wp.nextthink = time; - wp.model1 = spr; + wp.model1 = spr.netname; wp.customizeentityforclient = WaypointSprite_Customize; wp.waypointsprite_visible_for_player = WaypointSprite_visible_for_player; wp.reset2 = WaypointSprite_Reset; wp.cnt = icon; - wp.colormod = rgb; + wp.colormod = spr.m_color; Net_LinkEntity(wp, false, 0, WaypointSprite_SendEntity); return wp; } entity WaypointSprite_SpawnFixed( - string spr, + entity spr, vector ofs, entity own, .entity ownfield, - float icon, vector rgb // initial icon and color + float icon // initial icon ) { - return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, own, ownfield, true, icon, rgb); + return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, own, ownfield, true, icon); } entity WaypointSprite_DeployFixed( - string spr, + entity spr, float limited_range, vector ofs, - float icon, vector rgb // initial icon and color + float icon // initial icon ) { float t; @@ -1127,22 +1079,22 @@ 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, icon, rgb); + return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, world, ofs, world, t, self, waypointsprite_deployed_fixed, false, icon); } entity WaypointSprite_DeployPersonal( - string spr, + entity spr, vector ofs, - float icon, vector rgb // initial icon and color + float icon // initial icon ) { - return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, false, icon, rgb); + return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, false, icon); } entity WaypointSprite_Attach( - string spr, + entity spr, float limited_range, - float icon, vector rgb // initial icon and color + float icon // initial icon ) { float t; @@ -1157,17 +1109,17 @@ 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, icon, rgb); + return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, self, '0 0 64', world, t, self, waypointsprite_attached, false, icon); } entity WaypointSprite_AttachCarrier( - string spr, + entity spr, entity carrier, - float icon, vector rgb // initial icon and color + float icon // initial icon and color ) { WaypointSprite_Kill(carrier.waypointsprite_attached); // FC overrides attached - entity e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, false, icon, rgb); + entity e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, false, icon); if (e) { WaypointSprite_UpdateMaxHealth(e, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON) * 2); diff --git a/qcsrc/common/mutators/mutator/waypointsprites.qh b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh similarity index 93% rename from qcsrc/common/mutators/mutator/waypointsprites.qh rename to qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh index 0c6cfadf5..d6ea51867 100644 --- a/qcsrc/common/mutators/mutator/waypointsprites.qh +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh @@ -1,6 +1,11 @@ #ifndef WAYPOINTSPRITES_H #define WAYPOINTSPRITES_H +#include "all.qh" + +/** Additional networked waypoint state, used for items, weapons, buffs */ +.int wp_extra; + #ifdef CSQC entityclass(WaypointSprite); class(WaypointSprite) .float helpme; @@ -125,7 +130,7 @@ float autocvar_sv_waypointsprite_limitedrange; .float(entity) waypointsprite_visible_for_player; -void WaypointSprite_UpdateSprites(entity e, string m1, string m2, string m3); +void WaypointSprite_UpdateSprites(entity e, entity m1, entity m2, entity m3); void WaypointSprite_UpdateHealth(entity e, float f); @@ -171,50 +176,50 @@ float WaypointSprite_SendEntity(entity to, float sendflags); void WaypointSprite_Reset(); entity WaypointSprite_Spawn( - string spr, // sprite + entity spr, // sprite float lifetime, float maxdistance, // lifetime, max distance 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 icon, vector rgb // initial icon and color + float icon // initial icon ); entity WaypointSprite_SpawnFixed( - string spr, + entity spr, vector ofs, entity own, .entity ownfield, - float icon, vector rgb // initial icon and color + float icon // initial icon ); .entity waypointsprite_deployed_fixed; entity WaypointSprite_DeployFixed( - string spr, + entity spr, float limited_range, vector ofs, - float icon, vector rgb // initial icon and color + float icon // initial icon ); .entity waypointsprite_deployed_personal; entity WaypointSprite_DeployPersonal( - string spr, + entity spr, vector ofs, - float icon, vector rgb // initial icon and color + float icon // initial icon ); .entity waypointsprite_attached; .entity waypointsprite_attachedforcarrier; entity WaypointSprite_Attach( - string spr, + entity spr, float limited_range, - float icon, vector rgb // initial icon and color + float icon // initial icon ); entity WaypointSprite_AttachCarrier( - string spr, + entity spr, entity carrier, - float icon, vector rgb // initial icon and color + float icon // initial icon ); void WaypointSprite_DetachCarrier(entity carrier); diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index d4b1e1acf..17e1d7388 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -529,7 +529,8 @@ void vehicles_showwp() rgb = Team_ColorRGB(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); + entity wp = WaypointSprite_Spawn(WP_Vehicle, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP); + wp.colormod = rgb; if(self.waypointsprite_attached) { WaypointSprite_UpdateRule(self.waypointsprite_attached, self.wp00.team, SPRITERULE_DEFAULT); @@ -1023,8 +1024,10 @@ void vehicles_enter(entity pl, entity veh) Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_VEHICLE_STEAL_SELF); - if(autocvar_g_vehicles_steal_show_waypoint) - WaypointSprite_Spawn("intruder", 0, 0, pl, '0 0 68', world, veh.team, veh, wps_intruder, true, RADARICON_DANGER, Team_ColorRGB(pl.team)); + if (autocvar_g_vehicles_steal_show_waypoint) { + entity wp = WaypointSprite_Spawn(WP_VehicleIntruder, 0, 0, pl, '0 0 68', world, veh.team, veh, wps_intruder, true, RADARICON_DANGER); + wp.colormod = Team_ColorRGB(pl.team); + } } else return; diff --git a/qcsrc/common/weapons/w_seeker.qc b/qcsrc/common/weapons/w_seeker.qc index 313d5defd..13687eeb0 100644 --- a/qcsrc/common/weapons/w_seeker.qc +++ b/qcsrc/common/weapons/w_seeker.qc @@ -546,7 +546,7 @@ void W_Seeker_Tag_Touch(void) if(WEP_CVAR(seeker, type) == 1) { - WaypointSprite_Spawn("tagged-target", WEP_CVAR(seeker, tag_tracker_lifetime), 0, other, '0 0 64', self.realowner, 0, other, wps_tag_tracker, true, RADARICON_TAGGED, '0.5 1 0'); + WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(seeker, tag_tracker_lifetime), 0, other, '0 0 64', self.realowner, 0, other, wps_tag_tracker, true, RADARICON_TAGGED); WaypointSprite_UpdateRule(other.wps_tag_tracker, 0, SPRITERULE_DEFAULT); } } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 8caae09dd..8460cb38a 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -33,7 +33,7 @@ #include "../common/items/all.qc" -#include "../common/mutators/mutator/waypointsprites.qh" +#include "../common/mutators/mutator/waypoints/all.qh" #include "../common/triggers/subs.qh" #include "../common/triggers/triggers.qh" diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index 692b0c269..61c8d49aa 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -167,14 +167,14 @@ void ImpulseCommands (void) switch(imp) { case 30: - wp = WaypointSprite_DeployPersonal("waypoint", self.origin, RADARICON_WAYPOINT, '0 1 1'); + wp = WaypointSprite_DeployPersonal(WP_Waypoint, self.origin, RADARICON_WAYPOINT); if(wp) WaypointSprite_Ping(wp); sprint(self, "personal waypoint spawned at location\n"); break; case 31: WarpZone_crosshair_trace(self); - wp = WaypointSprite_DeployPersonal("waypoint", trace_endpos, RADARICON_WAYPOINT, '0 1 1'); + wp = WaypointSprite_DeployPersonal(WP_Waypoint, trace_endpos, RADARICON_WAYPOINT); if(wp) WaypointSprite_Ping(wp); sprint(self, "personal waypoint spawned at crosshair\n"); @@ -182,7 +182,7 @@ void ImpulseCommands (void) case 32: if(vlen(self.death_origin)) { - wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin, RADARICON_WAYPOINT, '0 1 1'); + wp = WaypointSprite_DeployPersonal(WP_Waypoint, self.death_origin, RADARICON_WAYPOINT); if(wp) WaypointSprite_Ping(wp); sprint(self, "personal waypoint spawned at death location\n"); @@ -193,7 +193,7 @@ void ImpulseCommands (void) { if (!MUTATOR_CALLHOOK(HelpMePing, self)) { - wp = WaypointSprite_Attach("helpme", true, RADARICON_HELPME, '1 0.5 0'); + wp = WaypointSprite_Attach(WP_Helpme, true, RADARICON_HELPME); if(!wp) WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier); else @@ -203,14 +203,14 @@ void ImpulseCommands (void) } break; case 34: - wp = WaypointSprite_DeployFixed("here", false, self.origin, RADARICON_HERE, '0 1 0'); + wp = WaypointSprite_DeployFixed(WP_Here, false, self.origin, RADARICON_HERE); if(wp) WaypointSprite_Ping(wp); sprint(self, "HERE spawned at location\n"); break; case 35: WarpZone_crosshair_trace(self); - wp = WaypointSprite_DeployFixed("here", false, trace_endpos, RADARICON_HERE, '0 1 0'); + wp = WaypointSprite_DeployFixed(WP_Here, false, trace_endpos, RADARICON_HERE); if(wp) WaypointSprite_Ping(wp); sprint(self, "HERE spawned at crosshair\n"); @@ -218,21 +218,21 @@ void ImpulseCommands (void) case 36: if(vlen(self.death_origin)) { - wp = WaypointSprite_DeployFixed("here", false, self.death_origin, RADARICON_HERE, '0 1 0'); + wp = WaypointSprite_DeployFixed(WP_Here, false, self.death_origin, RADARICON_HERE); if(wp) WaypointSprite_Ping(wp); sprint(self, "HERE spawned at death location\n"); } break; case 37: - wp = WaypointSprite_DeployFixed("danger", false, self.origin, RADARICON_DANGER, '1 0.5 0'); + wp = WaypointSprite_DeployFixed(WP_Danger, false, self.origin, RADARICON_DANGER); if(wp) WaypointSprite_Ping(wp); sprint(self, "DANGER spawned at location\n"); break; case 38: WarpZone_crosshair_trace(self); - wp = WaypointSprite_DeployFixed("danger", false, trace_endpos, RADARICON_DANGER, '1 0.5 0'); + wp = WaypointSprite_DeployFixed(WP_Danger, false, trace_endpos, RADARICON_DANGER); if(wp) WaypointSprite_Ping(wp); sprint(self, "DANGER spawned at crosshair\n"); @@ -240,7 +240,7 @@ void ImpulseCommands (void) case 39: if(vlen(self.death_origin)) { - wp = WaypointSprite_DeployFixed("danger", false, self.death_origin, RADARICON_DANGER, '1 0.5 0'); + wp = WaypointSprite_DeployFixed(WP_Danger, false, self.death_origin, RADARICON_DANGER); if(wp) WaypointSprite_Ping(wp); sprint(self, "DANGER spawned at death location\n"); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 238040406..967a475e1 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -594,7 +594,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo // add waypoint if(show_waypoint) - WaypointSprite_Spawn("frozen", 0, 0, targ, '0 0 64', world, targ.team, targ, waypointsprite_attached, true, RADARICON_WAYPOINT, '0.25 0.90 1'); + WaypointSprite_Spawn(WP_Frozen, 0, 0, targ, '0 0 64', world, targ.team, targ, waypointsprite_attached, true, RADARICON_WAYPOINT); } void Unfreeze (entity targ) diff --git a/qcsrc/server/mutators/gamemode_assault.qc b/qcsrc/server/mutators/gamemode_assault.qc index 4700c57d8..6364b7dad 100644 --- a/qcsrc/server/mutators/gamemode_assault.qc +++ b/qcsrc/server/mutators/gamemode_assault.qc @@ -131,20 +131,20 @@ void target_objective_decrease_activate() ent.sprite = world; } - spr = WaypointSprite_SpawnFixed("", 0.5 * (ent.absmin + ent.absmax), ent, assault_sprite, RADARICON_OBJECTIVE, '1 0.5 0'); + spr = WaypointSprite_SpawnFixed(WP_Assault, 0.5 * (ent.absmin + ent.absmax), ent, assault_sprite, RADARICON_OBJECTIVE); spr.assault_decreaser = self; spr.waypointsprite_visible_for_player = assault_decreaser_sprite_visible; spr.classname = "sprite_waypoint"; WaypointSprite_UpdateRule(spr, assault_attacker_team, SPRITERULE_TEAMPLAY); if(ent.classname == "func_assault_destructible") { - WaypointSprite_UpdateSprites(spr, "as-defend", "as-destroy", "as-destroy"); + WaypointSprite_UpdateSprites(spr, WP_AssaultDefend, WP_AssaultDestroy, WP_AssaultDestroy); WaypointSprite_UpdateMaxHealth(spr, ent.max_health); WaypointSprite_UpdateHealth(spr, ent.health); ent.sprite = spr; } else - WaypointSprite_UpdateSprites(spr, "as-defend", "as-push", "as-push"); + WaypointSprite_UpdateSprites(spr, WP_AssaultDefend, WP_AssaultPush, WP_AssaultPush); } } diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 87bbb3b99..6ebf651f2 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -53,7 +53,7 @@ void ctf_CaptureRecord(entity flag, entity player) void ctf_FlagcarrierWaypoints(entity player) { - WaypointSprite_Spawn("flagcarrier", 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, true, RADARICON_FLAG, WPCOLOR_FLAGCARRIER(player.team)); + WaypointSprite_Spawn(WP_FlagCarrier, 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, true, RADARICON_FLAG); WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON) * 2); WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON)); WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, WPCOLOR_FLAGCARRIER(player.team)); @@ -248,8 +248,10 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) PlayerScore_Add(player, SP_CTF_DROPS, 1); // waypoints - if(autocvar_g_ctf_flag_dropped_waypoint) - 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_dropped_waypoint) { + entity wp = WaypointSprite_Spawn(WP_FlagDropped, 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, true, RADARICON_FLAG); + wp.colormod = WPCOLOR_DROPPEDFLAG(flag.team); + } if(autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health)) { @@ -712,7 +714,8 @@ void ctf_CheckStalemate(void) { if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier)) { - WaypointSprite_Spawn(((ctf_oneflag) ? "flagcarrier" : "enemyflagcarrier"), 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team)); + entity wp = WaypointSprite_Spawn(((ctf_oneflag) ? WP_FlagCarrier : WP_FlagCarrierEnemy), 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG); + wp.colormod = WPCOLOR_ENEMYFC(tmp_entity.owner.team); tmp_entity.owner.wps_enemyflagcarrier.customizeentityforclient = ctf_Stalemate_Customize; } } @@ -1063,18 +1066,18 @@ void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf self.bot_basewaypoint = self.nearestwaypoint; // waypointsprites - string basename = "base"; - - switch(self.team) + entity basename; + switch (self.team) { - case NUM_TEAM_1: basename = "redbase"; break; - case NUM_TEAM_2: basename = "bluebase"; break; - case NUM_TEAM_3: basename = "yellowbase"; break; - case NUM_TEAM_4: basename = "pinkbase"; break; - default: basename = "neutralbase"; break; + case NUM_TEAM_1: basename = WP_FlagBaseRed; break; + case NUM_TEAM_2: basename = WP_FlagBaseBlue; break; + case NUM_TEAM_3: basename = WP_FlagBaseYellow; break; + case NUM_TEAM_4: basename = WP_FlagBasePink; break; + default: basename = WP_FlagBaseNeutral; break; } - WaypointSprite_SpawnFixed(basename, self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, ((self.team) ? Team_ColorRGB(self.team) : '1 1 1')); + entity wp = WaypointSprite_SpawnFixed(basename, self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG); + wp.colormod = ((self.team) ? Team_ColorRGB(self.team) : '1 1 1'); WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, ((self.team) ? colormapPaletteColor(self.team - 1, false) : '1 1 1')); // captureshield setup @@ -2126,7 +2129,7 @@ MUTATOR_HOOKFUNCTION(ctf_HelpMePing) } else // create a normal help me waypointsprite { - WaypointSprite_Spawn("helpme", waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME, '1 0.5 0'); + WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME); WaypointSprite_Ping(self.wps_helpme); } diff --git a/qcsrc/server/mutators/gamemode_ctf.qh b/qcsrc/server/mutators/gamemode_ctf.qh index a9e83a2a5..b5ff1774a 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qh +++ b/qcsrc/server/mutators/gamemode_ctf.qh @@ -37,7 +37,7 @@ const float VEHICLE_FLAG_SCALE = 1.0; // waypoint colors #define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1') -#define WPCOLOR_FLAGCARRIER(t) ('0.8 0.8 0') +#define WPCOLOR_FLAGCARRIER(t) (WP_FlagCarrier.m_color) #define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1') // sounds diff --git a/qcsrc/server/mutators/gamemode_domination.qc b/qcsrc/server/mutators/gamemode_domination.qc index c365eddd3..d10cedcd8 100644 --- a/qcsrc/server/mutators/gamemode_domination.qc +++ b/qcsrc/server/mutators/gamemode_domination.qc @@ -24,7 +24,6 @@ void dompoint_captured () { entity head; float old_delay, old_team, real_team; - string msg = "dom-neut"; // now that the delay has expired, switch to the latest team to lay claim to this point head = self.owner; @@ -80,15 +79,16 @@ void dompoint_captured () self.delay = old_delay; self.team = old_team; + entity msg = WP_DomNeut; switch(self.team) { - case NUM_TEAM_1: msg = "dom-red"; break; - case NUM_TEAM_2: msg = "dom-blue"; break; - case NUM_TEAM_3: msg = "dom-yellow"; break; - case NUM_TEAM_4: msg = "dom-pink"; break; + case NUM_TEAM_1: msg = WP_DomRed; break; + case NUM_TEAM_2: msg = WP_DomBlue; break; + case NUM_TEAM_3: msg = WP_DomYellow; break; + case NUM_TEAM_4: msg = WP_DomPink; break; } - WaypointSprite_UpdateSprites(self.sprite, msg, "", ""); + WaypointSprite_UpdateSprites(self.sprite, msg, WP_Null, WP_Null); total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0; for(head = world; (head = find(head, classname, "dom_controlpoint")) != world; ) @@ -226,7 +226,7 @@ void dompointtouch() if(head == world) return; - WaypointSprite_UpdateSprites(self.sprite, "dom-neut", "", ""); + WaypointSprite_UpdateSprites(self.sprite, WP_DomNeut, WP_Null, WP_Null); WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, '0 1 1'); WaypointSprite_Ping(self.sprite); @@ -292,7 +292,7 @@ void dom_controlpoint_setup() droptofloor(); waypoint_spawnforitem(self); - WaypointSprite_SpawnFixed("dom-neut", self.origin + '0 0 32', self, sprite, RADARICON_DOMPOINT, '0 1 1'); + WaypointSprite_SpawnFixed(WP_DomNeut, self.origin + '0 0 32', self, sprite, RADARICON_DOMPOINT); } float total_controlpoints, redowned, blueowned, yellowowned, pinkowned; diff --git a/qcsrc/server/mutators/gamemode_keepaway.qc b/qcsrc/server/mutators/gamemode_keepaway.qc index 8cc302486..01695f5e2 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -50,7 +50,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated Send_Effect("electro_combo", oldballorigin, '0 0 0', 1); Send_Effect("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, RADARICON_FLAGCARRIER, '0 1 1'); + WaypointSprite_Spawn(WP_KaBall, 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); WaypointSprite_Ping(self.waypointsprite_attachedforcarrier); sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) @@ -118,7 +118,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth PlayerScore_Add(other, SP_KEEPAWAY_PICKUPS, 1); // waypoints - WaypointSprite_AttachCarrier("ka-ballcarrier", other, RADARICON_FLAGCARRIER, '1 0 0'); + WaypointSprite_AttachCarrier(WP_KaBallCarrier, other, RADARICON_FLAGCARRIER); other.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = ka_ballcarrier_waypointsprite_visible_for_player; WaypointSprite_UpdateRule(other.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); WaypointSprite_Ping(other.waypointsprite_attachedforcarrier); @@ -160,7 +160,7 @@ 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, RADARICON_FLAGCARRIER, '0 1 1'); + WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); 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 5fa2f6db2..1de67e2b0 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -351,17 +351,18 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic if(key.kh_next == world) { // player is now a key carrier - WaypointSprite_AttachCarrier("", player, RADARICON_FLAGCARRIER, colormapPaletteColor(player.team - 1, 0)); + entity wp = WaypointSprite_AttachCarrier(WP_Null, player, RADARICON_FLAGCARRIER); + wp.colormod = colormapPaletteColor(player.team - 1, 0); player.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_KeyCarrier_waypointsprite_visible_for_player; WaypointSprite_UpdateRule(player.waypointsprite_attachedforcarrier, player.team, SPRITERULE_TEAMPLAY); if(player.team == NUM_TEAM_1) - WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-red", "keycarrier-friend", "keycarrier-red"); + WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierRed, WP_KeyCarrierFriend, WP_KeyCarrierRed); else if(player.team == NUM_TEAM_2) - WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-blue", "keycarrier-friend", "keycarrier-blue"); + WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierBlue, WP_KeyCarrierFriend, WP_KeyCarrierBlue); else if(player.team == NUM_TEAM_3) - WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-yellow", "keycarrier-friend", "keycarrier-yellow"); + WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierYellow, WP_KeyCarrierFriend, WP_KeyCarrierYellow); else if(player.team == NUM_TEAM_4) - WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-pink", "keycarrier-friend", "keycarrier-pink"); + WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierPink, WP_KeyCarrierFriend, WP_KeyCarrierPink); if(!kh_no_radar_circles) WaypointSprite_Ping(player.waypointsprite_attachedforcarrier); } @@ -383,8 +384,12 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic // audit all key carrier sprites, update them to RUN HERE FOR_EACH_KH_KEY(k) { - if(k.owner) - WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, k.owner.waypointsprite_attachedforcarrier.model1, "keycarrier-finish", k.owner.waypointsprite_attachedforcarrier.model3); + if (!k.owner) continue; + entity first = WP_Null; + FOREACH(WAYPOINTS, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, LAMBDA(first = it; break)); + entity third = WP_Null; + FOREACH(WAYPOINTS, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, LAMBDA(third = it; break)); + WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFinish, third); } } else @@ -394,8 +399,12 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic // audit all key carrier sprites, update them to RUN HERE FOR_EACH_KH_KEY(k) { - if(k.owner) - WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, k.owner.waypointsprite_attachedforcarrier.model1, "keycarrier-friend", k.owner.waypointsprite_attachedforcarrier.model3); + if (!k.owner) continue; + entity first = WP_Null; + FOREACH(WAYPOINTS, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, LAMBDA(first = it; break)); + entity third = WP_Null; + FOREACH(WAYPOINTS, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, LAMBDA(third = it; break)); + WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFriend, third); } } } @@ -773,7 +782,7 @@ void kh_Key_Spawn(entity initial_owner, float angle, float i) // runs every tim Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, APP_TEAM_NUM_4(initial_owner.team, CENTER_KEYHUNT_START_)); - 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'); + WaypointSprite_Spawn(WP_KeyDropped, 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, false, RADARICON_FLAG); key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player; kh_Key_AssignTo(key, initial_owner); diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index a22a17110..91ed4ef9c 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -144,7 +144,7 @@ void GiveBall(entity plyr, entity ball) ball.effects |= EF_NOSHADOW; ball.scale = 1; // scale down. - WaypointSprite_AttachCarrier("nb-ball", plyr, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); + WaypointSprite_AttachCarrier(WP_NbBall, plyr, RADARICON_FLAGCARRIER); WaypointSprite_UpdateRule(plyr.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); if(autocvar_g_nexball_basketball_delay_hold) @@ -188,7 +188,7 @@ void DropBall(entity ball, vector org, vector vel) } WaypointSprite_Kill(ball.owner.waypointsprite_attachedforcarrier); - 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_Spawn(WP_NbBall, 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); // no health bar please WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); ball.owner.ballcarried = world; @@ -530,7 +530,7 @@ void SpawnBall(void) precache_sound(self.noise1); precache_sound(self.noise2); - WaypointSprite_AttachCarrier("nb-ball", self, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); // the ball's team is not set yet, no rule update needed + WaypointSprite_AttachCarrier(WP_NbBall, self, RADARICON_FLAGCARRIER); // the ball's team is not set yet, no rule update needed self.reset = ball_restart; self.think = InitBall; @@ -589,7 +589,8 @@ void SpawnGoal(void) if(self.team != GOAL_OUT && Team_TeamToNumber(self.team) != -1) { - WaypointSprite_SpawnFixed("goal", (self.absmin + self.absmax) * 0.5, self, sprite, RADARICON_NONE, ((self.team) ? Team_ColorRGB(self.team) : '1 0.5 0')); + entity wp = WaypointSprite_SpawnFixed(WP_NbGoal, (self.absmin + self.absmax) * 0.5, self, sprite, RADARICON_NONE); + wp.colormod = ((self.team) ? Team_ColorRGB(self.team) : '1 0.5 0'); self.sprite.customizeentityforclient = nb_Goal_Customize; } diff --git a/qcsrc/server/mutators/gamemode_nexball.qh b/qcsrc/server/mutators/gamemode_nexball.qh index 199e15c3b..e28fad883 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qh +++ b/qcsrc/server/mutators/gamemode_nexball.qh @@ -6,7 +6,6 @@ const float BALL_EFFECTMASK = 1229; const vector BALL_MINS = '-16 -16 -16'; // The model is 24*24*24 const vector BALL_MAXS = '16 16 16'; const vector BALL_ATTACHORG = '3 0 16'; -const vector BALL_SPRITECOLOR = '0.91 0.85 0.62'; const float BALL_FOOT = 1; const float BALL_BASKET = 2; //spawnflags diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index fb6e0c10e..448664a90 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -604,26 +604,25 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player) onslaught_controlpoint_icon_link(e, ons_ControlPoint_Icon_BuildThink); } -string ons_ControlPoint_Waypoint(entity e) +entity ons_ControlPoint_Waypoint(entity e) { if(e.team) { int a = ons_ControlPoint_Attackable(e, e.team); - if(a == -2) { return "ons-cp-dfnd"; } // defend now - if(a == -1 || a == 1 || a == 2) { return "ons-cp"; } // touch - if(a == 3 || a == 4) { return "ons-cp-atck"; } // attack + if(a == -2) { return WP_OnsCPDefend; } // defend now + if(a == -1 || a == 1 || a == 2) { return WP_OnsCP; } // touch + if(a == 3 || a == 4) { return WP_OnsCPAttack; } // attack } else - return "ons-cp"; + return WP_OnsCP; - return ""; + return WP_Null; } void ons_ControlPoint_UpdateSprite(entity e) { - string s1; - s1 = ons_ControlPoint_Waypoint(e); + entity s1 = ons_ControlPoint_Waypoint(e); WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1); bool sh; @@ -807,7 +806,7 @@ void ons_ControlPoint_Setup(entity cp) } // waypointsprites - WaypointSprite_SpawnFixed(string_null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE, '0 0 0'); + WaypointSprite_SpawnFixed(WP_Null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE); WaypointSprite_UpdateRule(self.sprite, self.team, SPRITERULE_TEAMPLAY); InitializeEntity(cp, ons_DelayedControlPoint_Setup, INITPRIO_SETLOCATION); @@ -818,16 +817,16 @@ void ons_ControlPoint_Setup(entity cp) // Main Generator Functions // ========================= -string ons_Generator_Waypoint(entity e) +entity ons_Generator_Waypoint(entity e) { - if(e.isshielded) - return "ons-gen-shielded"; - return "ons-gen"; + if (e.isshielded) + return WP_OnsGenShielded; + return WP_OnsGen; } void ons_Generator_UpdateSprite(entity e) { - string s1 = ons_Generator_Waypoint(e); + entity s1 = ons_Generator_Waypoint(e); WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1); if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded) @@ -1061,7 +1060,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o droptofloor(); // waypointsprites - WaypointSprite_SpawnFixed(string_null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE, '0 0 0'); + WaypointSprite_SpawnFixed(WP_Null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE); WaypointSprite_UpdateRule(self.sprite, self.team, SPRITERULE_TEAMPLAY); WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health); WaypointSprite_UpdateHealth(self.sprite, self.health); diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index f144899c8..cd327e3ea 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -89,7 +89,8 @@ float buff_Waypoint_visible_for_player(entity plr) void buff_Waypoint_Spawn(entity e) { entity buff = buff_FirstFromFlags(e.buffs); - WaypointSprite_Spawn(buff.m_sprite, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, world, e.team, e, buff_waypoint, true, RADARICON_POWERUP, e.glowmod); + entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, world, e.team, e, buff_waypoint, true, RADARICON_POWERUP); + wp.wp_extra = buff.m_id; WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_POWERUP, e.glowmod); e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player; } diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index cc6d8c4f5..eab7017d1 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -827,9 +827,9 @@ void trigger_race_checkpoint_verify() if(defrag_ents) { for(cp = world; (cp = find(cp, classname, "target_startTimer"));) - WaypointSprite_UpdateSprites(cp.sprite, "race-start", "", ""); + WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null); for(cp = world; (cp = find(cp, classname, "target_stopTimer"));) - WaypointSprite_UpdateSprites(cp.sprite, "race-finish", "", ""); + WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null); for(cp = world; (cp = find(cp, classname, "target_checkpoint"));) { @@ -862,9 +862,9 @@ void trigger_race_checkpoint_verify() if(cp.sprite) { if(cp.race_checkpoint == 0) - WaypointSprite_UpdateSprites(cp.sprite, "race-start", "", ""); + WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null); else if(cp.race_checkpoint == race_timed_checkpoint) - WaypointSprite_UpdateSprites(cp.sprite, "race-finish", "", ""); + WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null); } } } @@ -967,9 +967,9 @@ void spawnfunc_trigger_race_checkpoint() if(!self.race_penalty) { if(self.race_checkpoint) - WaypointSprite_SpawnFixed("race-checkpoint", o, self, sprite, RADARICON_NONE, '1 0.5 0'); + WaypointSprite_SpawnFixed(WP_RaceCheckpoint, o, self, sprite, RADARICON_NONE); else - WaypointSprite_SpawnFixed("race-start-finish", o, self, sprite, RADARICON_NONE, '1 0.5 0'); + WaypointSprite_SpawnFixed(WP_RaceStartFinish, o, self, sprite, RADARICON_NONE); } self.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; @@ -1010,9 +1010,9 @@ void spawnfunc_target_checkpoint() // defrag entity race_timed_checkpoint = 1; if(self.race_checkpoint == 0) - WaypointSprite_SpawnFixed("race-start", o, self, sprite, RADARICON_NONE, '1 0.5 0'); + WaypointSprite_SpawnFixed(WP_RaceStart, o, self, sprite, RADARICON_NONE); else - WaypointSprite_SpawnFixed("race-checkpoint", o, self, sprite, RADARICON_NONE, '1 0.5 0'); + WaypointSprite_SpawnFixed(WP_RaceCheckpoint, o, self, sprite, RADARICON_NONE); self.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index a0dbb61d2..a6d4d2402 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -455,40 +455,22 @@ void Item_RespawnCountdown (void) self.count += 1; if(self.count == 1) { - string name = string_null; - vector rgb = '1 0 1'; + MUTATOR_CALLHOOK(Item_RespawnCountdown, string_null, '0 0 0'); + int wpextra = 0; entity e = self.itemdef; - if (e) { - name = e.m_waypoint; - rgb = e.m_color; - } - MUTATOR_CALLHOOK(Item_RespawnCountdown, name, rgb); - name = item_name; - rgb = item_color; - if(self.flags & FL_WEAPON) - { + if (e) wpextra = e.m_id; + if (self.flags & FL_WEAPON) { entity wi = get_weaponinfo(self.weapon); - if(wi) - { - name = wi.wpmodel; - rgb = '1 0 0'; - } - } - if(name) - { - WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP, rgb); - if(self.waypointsprite_attached) - { - if (self.items == IT_HEALTH || self.items == IT_ARMOR) - WaypointSprite_UpdateRule(self.waypointsprite_attached, 0, SPRITERULE_SPECTATOR); - WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS); - } - } - else - { - print("Unknown powerup-marked item is wanting to respawn\n"); - localcmd(sprintf("prvm_edict server %d\n", num_for_edict(self))); + if (wi) wpextra = wi.m_id; } + entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP); + wp.wp_extra = wpextra; + if(self.waypointsprite_attached) + { + if (self.items == IT_HEALTH || self.items == IT_ARMOR) + WaypointSprite_UpdateRule(self.waypointsprite_attached, 0, SPRITERULE_SPECTATOR); + WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS); + } } if(self.waypointsprite_attached) diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 1190dceb1..8a4edbd9b 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -91,15 +91,16 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) continue; if(!(e.flags & FL_ITEM)) continue; - WaypointSprite_Spawn( - (get_weaponinfo(wpn)).wpmodel, + entity wp = WaypointSprite_Spawn( + WP_Weapon, 1, 0, world, e.origin + ('0 0 1' * e.maxs.z) * 1.2, self, 0, world, enemy, 0, - RADARICON_NONE, '0 0 0' + RADARICON_NONE ); + wp.wp_extra = wpn; } } } -- 2.39.2