/** If you register a new waypoint, make sure to add it to this list */
-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(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(Frozen, _("Frozen!"), "", '0.25 0.90 1', 1);
-REGISTER_WAYPOINT(Item, _("Item"), '1 0 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(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(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(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(FlagReturn, _("Return flag here"), '0 0.8 0.8', 1);
+REGISTER_WAYPOINT(FlagCarrier, _("Flag carrier"), "", '0.8 0.8 0', 1);
+REGISTER_WAYPOINT(FlagCarrierEnemy, _("Enemy carrier"), "flag_neutral_carrying", '1 1 1', 1);
+REGISTER_WAYPOINT(FlagDropped, _("Dropped flag"), "flag_neutral_lost", '1 1 1', 1);
+REGISTER_WAYPOINT(FlagBaseNeutral, _("White base"), "flag_neutral_taken", '0.8 0.8 0', 1);
+REGISTER_WAYPOINT(FlagBaseRed, _("Red base"), "flag_red_taken", '0.8 0.8 0', 1);
+REGISTER_WAYPOINT(FlagBaseBlue, _("Blue base"), "flag_blue_taken", '0.8 0.8 0', 1);
+REGISTER_WAYPOINT(FlagBaseYellow, _("Yellow base"), "flag_yellow_taken", '0.8 0.8 0', 1);
+REGISTER_WAYPOINT(FlagBasePink, _("Pink base"), "flag_pink_taken", '0.8 0.8 0', 1);
+REGISTER_WAYPOINT(FlagReturn, _("Return flag here"), "", '0 0.8 0.8', 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(DomNeut, _("Control point"), "dom_icon_blue-highlighted", '0 1 1', 1);
+REGISTER_WAYPOINT(DomRed, _("Control point"), "dom_icon_red-highlighted", '0 1 1', 1);
+REGISTER_WAYPOINT(DomBlue, _("Control point"), "dom_icon_blue-highlighted", '0 1 1', 1);
+REGISTER_WAYPOINT(DomYellow, _("Control point"), "dom_icon_yellow-highlighted", '0 1 1', 1);
+REGISTER_WAYPOINT(DomPink, _("Control point"), "dom_icon_pink-highlighted", '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(KeyDropped, _("Dropped key"), "kh_dropped", '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"), "kh_red_carrying", '0 1 1', 1);
+REGISTER_WAYPOINT(KeyCarrierBlue, _("Key carrier"), "kh_blue_carrying", '0 1 1', 1);
+REGISTER_WAYPOINT(KeyCarrierYellow, _("Key carrier"), "kh_yellow_carrying", '0 1 1', 1);
+REGISTER_WAYPOINT(KeyCarrierPink, _("Key carrier"), "kh_pink_carrying", '0 1 1', 1);
-REGISTER_WAYPOINT(KaBall, _("Ball"), '0 1 1', 1);
-REGISTER_WAYPOINT(KaBallCarrier, _("Ball carrier"), '1 0 0', 1);
+REGISTER_WAYPOINT(KaBall, _("Ball"), "notify_ballpickedup", '0 1 1', 1);
+REGISTER_WAYPOINT(KaBallCarrier, _("Ball carrier"), "keepawayball_carrying", '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(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(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(Weapon, _("Weapon"), '0 0 0', 1);
+REGISTER_WAYPOINT(Weapon, _("Weapon"), "", '0 0 0', 1);
-REGISTER_WAYPOINT(Monster, _("Monster"), '1 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(Vehicle, _("Vehicle"), "", '1 1 1', 1);
+REGISTER_WAYPOINT(VehicleIntruder, _("Intruder!"), "", '1 1 1', 1);
-REGISTER_WAYPOINT(Seeker, _("Tagged"), '0.5 1 0', 2);
+REGISTER_WAYPOINT(Seeker, _("Tagged"), "", '0.5 1 0', 2);
return s;
}
+
+string spritelookupicon(entity this, string s)
+{
+ // TODO: needs icons! //if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
+ if (s == WP_Weapon.netname) return Weapons_from(this.wp_extra).model2;
+ if (s == WP_Item.netname) return Items_from(this.wp_extra).m_icon;
+ if (s == WP_Vehicle.netname) return Vehicles_from(this.wp_extra).m_icon;
+ //if (s == WP_Monster.netname) return get_monsterinfo(this.wp_extra).m_icon;
+ if (MUTATOR_CALLHOOK(WP_Format, this, s))
+ {
+ return M_ARGV(4, string);
+ }
+
+ // need to loop, as our netname could be one of three
+ FOREACH(Waypoints, it.netname == s, {
+ return it.m_icon;
+ });
+
+ return s;
+}
#endif
#ifdef CSQC
}
// returns location of sprite healthbar
-vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a, vector fontsize, string s)
+vector drawsprite_TextOrIcon(bool is_text, vector o, float ang, float minwidth, vector rgb, float a, vector sz, string str)
{
float algnx, algny;
float sw, w, h;
float aspect, sa, ca;
- sw = stringwidth(s, false, fontsize);
+ if (is_text)
+ sw = stringwidth(str, false, sz);
+ else
+ sw = sz.x;
+
if (sw > minwidth)
w = sw;
else
w = minwidth;
- h = fontsize.y;
+ h = sz.y;
// how do corners work?
aspect = vid_conwidth / vid_conheight;
if (o.x > vid_conwidth - w)
o.x = vid_conwidth - w;
if (o.y > vid_conheight - h)
- o.x = vid_conheight - h;
+ o.y = vid_conheight - h;
o.x += 0.5 * (w - sw);
- drawstring(o, s, fontsize, rgb, a, DRAWFLAG_NORMAL);
+ if (is_text)
+ drawstring(o, str, sz, rgb, a, DRAWFLAG_NORMAL);
+ else
+ drawpic(o, str, sz, rgb, a, DRAWFLAG_NORMAL);
o.x += 0.5 * sw;
o.y += 0.5 * h;
o = drawspritearrow(o, ang, rgb, a, SPRITE_ARROW_SCALE * t);
- string txt;
- if (autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
- txt = _("Spam");
+ string pic = "";
+ bool is_text = true;
+ if (!autocvar_g_waypointsprite_text)
+ {
+ string spr_icon = spritelookupicon(this, spriteimage);
+ pic = spr_icon;
+ bool icon_found = !(!spr_icon || spr_icon == "");
+ if (icon_found) // it's valid, but let's make sure it exists!
+ {
+ pic = strcat(hud_skin_path, "/", spr_icon);
+ if(precache_pic(pic) == "")
+ {
+ pic = strcat("gfx/hud/default/", spr_icon);
+ if(!precache_pic(pic))
+ icon_found = false;
+ }
+ }
+ if (icon_found)
+ is_text = false;
+ }
+
+ vector sz;
+ vector txt_color;
+ string txt = string_null;
+ if (is_text)
+ {
+ if (autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
+ txt = "Spam"; // no need to translate this debug string
+ else
+ txt = spritelookuptext(this, spriteimage);
+ if (this.helpme && time < this.helpme)
+ txt = sprintf(_("%s needing help!"), txt);
+ if (autocvar_g_waypointsprite_uppercase)
+ txt = strtoupper(txt);
+ txt_color = rgb;
+ sz = waypointsprite_fontsize * '1 1 0';
+ }
else
- txt = spritelookuptext(this, spriteimage);
- if (this.helpme && time < this.helpme)
- txt = sprintf(_("%s needing help!"), txt);
- if (autocvar_g_waypointsprite_uppercase)
- txt = strtoupper(txt);
+ {
+ // for convenience icon path and color are saved to txt and txt_color
+ txt = pic;
+ txt_color = ((autocvar_g_waypointsprite_iconcolor) ? '1 1 1' : rgb);
+ sz = autocvar_g_waypointsprite_iconsize * '1 1 0';
+ }
draw_beginBoldFont();
if (this.health >= 0)
{
- o = drawspritetext(o, ang, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt);
-
- float align, marg;
+ float align = 0, marg;
if (this.build_finished)
align = 0.5;
else
align = 0;
if (cos(ang) > 0)
- marg = -(SPRITE_HEALTHBAR_MARGIN + SPRITE_HEALTHBAR_HEIGHT + 2 * SPRITE_HEALTHBAR_BORDER) * t - 0.5 * waypointsprite_fontsize;
+ marg = -(SPRITE_HEALTHBAR_MARGIN + SPRITE_HEALTHBAR_HEIGHT + 2 * SPRITE_HEALTHBAR_BORDER) * t - 0.5 * sz.y;
else
- marg = SPRITE_HEALTHBAR_MARGIN * t + 0.5 * waypointsprite_fontsize;
+ marg = SPRITE_HEALTHBAR_MARGIN * t + 0.5 * sz.y;
+
+ float minwidth = (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t;
+ o = drawsprite_TextOrIcon(is_text, o, ang, minwidth, txt_color, a, sz, txt);
drawhealthbar(
o,
0,
}
else
{
- o = drawspritetext(o, ang, 0, rgb, a, waypointsprite_fontsize * '1 1 0', txt);
+ drawsprite_TextOrIcon(is_text, o, ang, 0, txt_color, a, sz, txt);
}
+
draw_endBoldFont();
}