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/gamewindow.cc | 5 +++++ src/client/hud.cc | 27 +++++++++++++++++++++------ src/client/targets.cc | 2 ++ 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'src/client') diff --git a/src/client/gamewindow.cc b/src/client/gamewindow.cc index 71a2171..0b39cea 100644 --- a/src/client/gamewindow.cc +++ b/src/client/gamewindow.cc @@ -402,6 +402,11 @@ void GameWindow::draw() gamewindow_launchbutton->hide(); gamewindow_freeflightbutton->show(); + if (core::localplayer()->autopilot_target()) { + gamewindow_freeflightbutton->enable(); + } else { + gamewindow_freeflightbutton->disable(); + } gamewindow_gotobutton->show(); gamewindow_dockbutton->show(); gamewindow_formationbutton->show(); 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); diff --git a/src/client/targets.cc b/src/client/targets.cc index 088d334..466b4a9 100644 --- a/src/client/targets.cc +++ b/src/client/targets.cc @@ -68,6 +68,8 @@ bool is_valid_hud_target(const core::Entity *entity) return true; } else if (entity == core::localplayer()->mission_target()) { return true; + } else if (entity == core::localplayer()->autopilot_target()) { + return true; } else if (!ext_render(entity)) { return false; } else { -- cgit v1.2.3