From f192b3019662e9ca6805992ba5e879e5b50b0958 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 12 Nov 2013 21:09:30 +0000 Subject: Support for player autopilot terget next to mission target, bumped network protocol version to 28, disable freeflight button if there is no autopilot target. --- src/client/hud.cc | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/client/hud.cc') diff --git a/src/client/hud.cc b/src/client/hud.cc index 1fabe10..4c98bd8 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -171,6 +171,8 @@ void HUD::draw_offscreen_target(core::Entity *entity, bool is_active_target) if (entity == core::localplayer()->mission_target()) { bitmap_color.assign(palette()->mission()); + } else if (entity == core::localplayer()->autopilot_target()) { + bitmap_color.assign(palette()->mission()); } render::Textures::bind(bitmap_material.c_str()); @@ -252,6 +254,7 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) std:: string bitmap_material; + // default target color if (controlable) { if (controlable->owner()) { bitmap_material.assign("bitmaps/hud/target_controlable"); @@ -262,25 +265,33 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) } else if (entity->has_flag(core::Entity::Dockable)) { bitmap_material.assign("bitmaps/hud/target_dockable"); - bitmap_color.assign(1.0f, 1.0f, 1.0f); // white + } else { bitmap_material.assign("bitmaps/hud/target_default"); bitmap_color.assign(palette()->text()); // default text color + } - // reputation color - if (reputation >= core::range::reputation_friendly) { + // mission, autopilot and reputation override target color + if (entity == core::localplayer()->mission_target()) { + // mission target + bitmap_color.assign(palette()->mission()); + + } else if (entity == core::localplayer()->autopilot_target()) { + // mission target + bitmap_color.assign(palette()->mission()); + + } else if (reputation >= core::range::reputation_friendly) { // friendly bitmap_color.assign(0.0f, 1.0f, 0.0f); // green + } else if (reputation <= core::range::reputation_hostile) { // hostile bitmap_color.assign(1.0f, 0.0f, 0.0f); // red + } - if (entity == core::localplayer()->mission_target()) { - bitmap_color.assign(palette()->mission()); - } ui::Paint::draw_bitmap(bitmap_location, bitmap_size, bitmap_color, bitmap_material); // --------------------------------------------------------- @@ -443,6 +454,10 @@ void HUD::draw() // draw current HUD target draw_target(entity, true); + } else if (entity == core::localplayer()->autopilot_target()) { + // draw current mission target + draw_target(entity, false); + } else if (entity == core::localplayer()->mission_target()) { // draw current mission target draw_target(entity, false); -- cgit v1.2.3