|
21 | 21 | #include "localization/localize.h" |
22 | 22 | #include "network/multi.h" |
23 | 23 | #include "object/object.h" |
| 24 | +#include "options/Option.h" |
24 | 25 | #include "playerman/player.h" |
25 | 26 | #include "radar/radar.h" |
26 | 27 | #include "radar/radarorb.h" |
@@ -88,6 +89,31 @@ int See_all = 0; |
88 | 89 |
|
89 | 90 | DCF_BOOL(see_all, See_all); |
90 | 91 |
|
| 92 | +RadarIconMode Radar_2d_icon_mode = RadarIconMode::On; |
| 93 | + |
| 94 | +static auto RadarIconModeOption __UNUSED = options::OptionBuilder<RadarIconMode>("HUD.Radar2dIconMode", |
| 95 | + std::pair<const char*, int>{"Radar 2D Icons", 1915}, |
| 96 | + std::pair<const char*, int>{"Controls how custom 2D ship icons are displayed on the radar", 1916}) |
| 97 | + .category(std::make_pair("Game", 1824)) |
| 98 | + .values({{RadarIconMode::Off, {"Off", 1286}}, |
| 99 | + {RadarIconMode::On, {"On", 1285}}, |
| 100 | + {RadarIconMode::TargetOnly, {"Target Only", 1917}}}) |
| 101 | + .default_val(RadarIconMode::On) |
| 102 | + .bind_to(&Radar_2d_icon_mode) |
| 103 | + .importance(56) |
| 104 | + .finish(); |
| 105 | + |
| 106 | +void radar_check_2d_icon_options() |
| 107 | +{ |
| 108 | + bool has_icons = std::any_of(Ship_info.begin(), Ship_info.end(), [](const ship_info& sip) { |
| 109 | + return sip.radar_image_2d_idx >= 0 || sip.radar_color_image_2d_idx >= 0; |
| 110 | + }); |
| 111 | + |
| 112 | + if (!has_icons) { |
| 113 | + options::OptionsManager::instance()->removeOption(RadarIconModeOption); |
| 114 | + } |
| 115 | +} |
| 116 | + |
91 | 117 | void radar_stuff_blip_info(object *objp, int is_bright, color **blip_color, int *blip_type) |
92 | 118 | { |
93 | 119 | ship *shipp = NULL; |
|
0 commit comments