From a98197b22f592803e5204c0263bb6bfee9a0fc24 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 7 Nov 2013 13:38:54 +0000 Subject: Apply reputation colors to HUD targets. --- src/client/hud.cc | 62 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 13 deletions(-) (limited to 'src/client/hud.cc') diff --git a/src/client/hud.cc b/src/client/hud.cc index d402cb2..0a02fee 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -133,22 +133,41 @@ void HUD::draw_offscreen_target(core::Entity *entity, bool is_active_target) //math::Vector2f bitmap_location(bitmap_center[0] - bitmap_radius, bitmap_center[1] - bitmap_radius); //math::Vector2f bitmap_size(2.0f * bitmap_radius, 2.0f * bitmap_radius); - math::Color bitmap_color; - std:: string bitmap_material("bitmaps/hud/offscreen_default"); + math::Color bitmap_color; + const float reputation = core::localplayer()->reputation(entity->faction()); + + std:: string bitmap_material("bitmaps/hud/offscreen_default"); - if (entity->type() == core::Entity::Controlable) { - //bitmap_material.assign("bitmaps/hud/offscreen_controlable"); - bitmap_color.assign(palette()->fancy()); + if (controlable) { + //if (controlable->owner()) { + // bitmap_material.assign("bitmaps/hud/offscreen_controlable"); + //} + + // reputation color + if (reputation > 50.0f) { + bitmap_color.assign(0.0f, 1.0f, 0.0f); // green + } else if (reputation < -50.0f) { + bitmap_color.assign(1.0f, 0.0f, 0.0f); // red + } else { + bitmap_color.assign(1.0f, 1.0f, 1.0f); // white + } } else if (entity->has_flag(core::Entity::Dockable)) { //bitmap_material.assign("bitmaps/hud/offscreen_dockable"); - bitmap_color.assign(palette()->foreground()); + + // reputation color + if (reputation > 50.0f) { + bitmap_color.assign(0.0f, 1.0f, 0.0f); // green + } else if (reputation < -50.0f) { + bitmap_color.assign(1.0f, 0.0f, 0.0f); // red + } else { + bitmap_color.assign(1.0f, 1.0f, 1.0f); // white + } } else { - //bitmap_material.assign("bitmaps/hud/offscreen_default"); bitmap_color.assign(palette()->text()); } - + if (entity == core::localplayer()->mission_target()) { bitmap_color.assign(palette()->mission()); } @@ -226,8 +245,11 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) } math::Vector2f bitmap_location(cx - bitmap_radius, cy - bitmap_radius); math::Vector2f bitmap_size(2.0f * bitmap_radius, 2.0f * bitmap_radius); - math::Color bitmap_color; - std:: string bitmap_material; + + math::Color bitmap_color; + const float reputation = core::localplayer()->reputation(entity->faction()); + + std:: string bitmap_material; if (controlable) { if (controlable->owner()) { @@ -236,12 +258,26 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) bitmap_material.assign("bitmaps/hud/target_default"); } - // FIXME reputation color - bitmap_color.assign(palette()->fancy()); + // reputation color + if (reputation > 50.0f) { + bitmap_color.assign(0.0f, 1.0f, 0.0f); // green + } else if (reputation < -50.0f) { + bitmap_color.assign(1.0f, 0.0f, 0.0f); // red + } else { + bitmap_color.assign(1.0f, 1.0f, 1.0f); // white + } } else if (entity->has_flag(core::Entity::Dockable)) { bitmap_material.assign("bitmaps/hud/target_dockable"); - bitmap_color.assign(palette()->foreground()); + + // reputation color + if (reputation > 50.0f) { + bitmap_color.assign(0.0f, 1.0f, 0.0f); // green + } else if (reputation < -50.0f) { + bitmap_color.assign(1.0f, 0.0f, 0.0f); // red + } else { + bitmap_color.assign(1.0f, 1.0f, 1.0f); // white + } } else { bitmap_material.assign("bitmaps/hud/target_default"); -- cgit v1.2.3