From f30f4b866b56965687ce88c58ee79f7e36a8dbbf Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 27 Jul 2006 02:46:14 +0000 Subject: [PATCH] Add support for drawing target markers (circles on top of any AI/MP aircraft) as part of the conformal HUD ladder. --- src/Instrumentation/HUD/HUD.hxx | 1 + src/Instrumentation/HUD/HUD_ladder.cxx | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Instrumentation/HUD/HUD.hxx b/src/Instrumentation/HUD/HUD.hxx index 113baf67b..6506cd7aa 100644 --- a/src/Instrumentation/HUD/HUD.hxx +++ b/src/Instrumentation/HUD/HUD.hxx @@ -570,6 +570,7 @@ private: float _compression; bool _frl; // fuselage reference line bool _target_spot; + bool _target_markers; bool _velocity_vector; bool _drift_marker; bool _alpha_bracket; diff --git a/src/Instrumentation/HUD/HUD_ladder.cxx b/src/Instrumentation/HUD/HUD_ladder.cxx index 9a763d868..556f1b4a1 100644 --- a/src/Instrumentation/HUD/HUD_ladder.cxx +++ b/src/Instrumentation/HUD/HUD_ladder.cxx @@ -51,6 +51,7 @@ HUD::Ladder::Ladder(HUD *hud, const SGPropertyNode *n, float x, float y) : _compression(n->getFloatValue("compression-factor")), _frl(n->getBoolValue("enable-fuselage-ref-line")), _target_spot(n->getBoolValue("enable-target-spot")), + _target_markers(n->getBoolValue("enable-target-markers")), _velocity_vector(n->getBoolValue("enable-velocity-vector")), _drift_marker(n->getBoolValue("enable-drift-marker")), _alpha_bracket(n->getBoolValue("enable-alpha-bracket")), @@ -282,6 +283,28 @@ void HUD::Ladder::draw(void) #endif } // if _velocity_vector + // draw hud markers on top of each AI/MP target + if ( _target_markers ) { + SGPropertyNode *models + = globals->get_props()->getNode("/ai/models", true); + for ( int i = 0; i < models->nChildren(); i++ ) { + SGPropertyNode *chld = models->getChild(i); + string name; + name = chld->getName(); + if ( name == "aircraft" || name == "multiplayer" ) { + string callsign = chld->getStringValue("callsign"); + if ( callsign != "" ) { + float h_deg = chld->getFloatValue("radar/h-offset"); + float v_deg = chld->getFloatValue("radar/v-offset"); + float pos_x = (h_deg * cos(roll_value) - + v_deg * sin(roll_value)) * _compression; + float pos_y = (v_deg * cos(roll_value) + + h_deg * sin(roll_value)) * _compression; + draw_circle(pos_x, pos_y, 8); + } + } + } + } //*************************************************************** // OBJECT MOVING RETICLE