1
0
Fork 0

Add support for drawing target markers (circles on top of any AI/MP aircraft)

as part of the conformal HUD ladder.
This commit is contained in:
curt 2006-07-27 02:46:14 +00:00
parent 5fc834f7f5
commit f30f4b866b
2 changed files with 24 additions and 0 deletions

View file

@ -570,6 +570,7 @@ private:
float _compression; float _compression;
bool _frl; // fuselage reference line bool _frl; // fuselage reference line
bool _target_spot; bool _target_spot;
bool _target_markers;
bool _velocity_vector; bool _velocity_vector;
bool _drift_marker; bool _drift_marker;
bool _alpha_bracket; bool _alpha_bracket;

View file

@ -51,6 +51,7 @@ HUD::Ladder::Ladder(HUD *hud, const SGPropertyNode *n, float x, float y) :
_compression(n->getFloatValue("compression-factor")), _compression(n->getFloatValue("compression-factor")),
_frl(n->getBoolValue("enable-fuselage-ref-line")), _frl(n->getBoolValue("enable-fuselage-ref-line")),
_target_spot(n->getBoolValue("enable-target-spot")), _target_spot(n->getBoolValue("enable-target-spot")),
_target_markers(n->getBoolValue("enable-target-markers")),
_velocity_vector(n->getBoolValue("enable-velocity-vector")), _velocity_vector(n->getBoolValue("enable-velocity-vector")),
_drift_marker(n->getBoolValue("enable-drift-marker")), _drift_marker(n->getBoolValue("enable-drift-marker")),
_alpha_bracket(n->getBoolValue("enable-alpha-bracket")), _alpha_bracket(n->getBoolValue("enable-alpha-bracket")),
@ -282,6 +283,28 @@ void HUD::Ladder::draw(void)
#endif #endif
} // if _velocity_vector } // 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 // OBJECT MOVING RETICLE