Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-07 13:38:54 +0000
committerStijn Buys <ingar@osirion.org>2013-11-07 13:38:54 +0000
commita98197b22f592803e5204c0263bb6bfee9a0fc24 (patch)
treeb4b991fa4f2be6417247e042bc57f427d9c59f6d /src/client
parent4896428eefa6e621523168a42dceda4f8f2b0097 (diff)
Apply reputation colors to HUD targets.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/hud.cc62
1 files changed, 49 insertions, 13 deletions
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");