Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/localization/localize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool *Lcl_unexpected_tstring_check = nullptr;
// NOTE: with map storage of XSTR strings, the indexes no longer need to be contiguous,
// but internal strings should still increment XSTR_SIZE to avoid collisions.
// retail XSTR_SIZE = 1570
// #define XSTR_SIZE 1915 // This is the next available ID
// #define XSTR_SIZE 1918 // This is the next available ID

// struct to allow for strings.tbl-determined x offset
// offset is 0 for english, by default
Expand Down
4 changes: 3 additions & 1 deletion code/radar/radar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ void HudGaugeRadarStd::drawBlips(int blip_type, int bright, int distort)
}
else
{
if (b->radar_image_2d == -1 && b->radar_color_image_2d == -1)
bool show_icon = (Radar_2d_icon_mode == RadarIconMode::On ||
(Radar_2d_icon_mode == RadarIconMode::TargetOnly && (b->flags & BLIP_CURRENT_TARGET)));
if (!show_icon || (b->radar_image_2d == -1 && b->radar_color_image_2d == -1))
drawContactCircle(x, y, b->rad);
else
drawContactImage(x, y, b->rad, b->radar_image_2d, b->radar_color_image_2d, b->radar_image_size);
Expand Down
10 changes: 7 additions & 3 deletions code/radar/radardradis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,14 @@ void HudGaugeRadarDradis::drawBlips(int blip_type, int bright, int distort)
} else {
if (b->flags & BLIP_DRAW_DISTORTED) {
blipDrawFlicker(b, &pos, alpha);
} else if (b->radar_image_2d >= 0 || b->radar_color_image_2d >= 0) {
drawContact(&pos, b->radar_image_2d, b->radar_color_image_2d, b->dist, alpha, scale_factor);
} else {
drawContact(&pos, -1, unknown_contact_icon, b->dist, alpha, scale_factor);
bool show_icon = (Radar_2d_icon_mode == RadarIconMode::On ||
(Radar_2d_icon_mode == RadarIconMode::TargetOnly && (b->flags & BLIP_CURRENT_TARGET)));
if (show_icon && (b->radar_image_2d >= 0 || b->radar_color_image_2d >= 0)) {
drawContact(&pos, b->radar_image_2d, b->radar_color_image_2d, b->dist, alpha, scale_factor);
} else {
drawContact(&pos, -1, unknown_contact_icon, b->dist, alpha, scale_factor);
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion code/radar/radarorb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ void HudGaugeRadarOrb::drawBlips(int blip_type, int bright, int distort)
}
else
{
if (b->radar_image_2d >= 0 || b->radar_color_image_2d >= 0)
bool show_icon = (Radar_2d_icon_mode == RadarIconMode::On ||
(Radar_2d_icon_mode == RadarIconMode::TargetOnly && (b->flags & BLIP_CURRENT_TARGET)));
if (show_icon && (b->radar_image_2d >= 0 || b->radar_color_image_2d >= 0))
{
drawContactImage(&pos, b->rad, b->radar_image_2d, b->radar_color_image_2d, b->radar_projection_size);
}
Expand Down
26 changes: 26 additions & 0 deletions code/radar/radarsetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "localization/localize.h"
#include "network/multi.h"
#include "object/object.h"
#include "options/Option.h"
#include "playerman/player.h"
#include "radar/radar.h"
#include "radar/radarorb.h"
Expand Down Expand Up @@ -88,6 +89,31 @@ int See_all = 0;

DCF_BOOL(see_all, See_all);

RadarIconMode Radar_2d_icon_mode = RadarIconMode::On;

static auto RadarIconModeOption __UNUSED = options::OptionBuilder<RadarIconMode>("HUD.Radar2dIconMode",
std::pair<const char*, int>{"Radar 2D Icons", 1915},
std::pair<const char*, int>{"Controls how custom 2D ship icons are displayed on the radar", 1916})
.category(std::make_pair("Game", 1824))
.values({{RadarIconMode::Off, {"Off", 1286}},
{RadarIconMode::On, {"On", 1285}},
{RadarIconMode::TargetOnly, {"Target Only", 1917}}})
.default_val(RadarIconMode::On)
.bind_to(&Radar_2d_icon_mode)
.importance(56)
.finish();

void radar_check_2d_icon_options()
{
bool has_icons = std::any_of(Ship_info.begin(), Ship_info.end(), [](const ship_info& sip) {
return sip.radar_image_2d_idx >= 0 || sip.radar_color_image_2d_idx >= 0;
});

if (!has_icons) {
options::OptionsManager::instance()->removeOption(RadarIconModeOption);
}
}

void radar_stuff_blip_info(object *objp, int is_bright, color **blip_color, int *blip_type)
{
ship *shipp = NULL;
Expand Down
8 changes: 8 additions & 0 deletions code/radar/radarsetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,18 @@ enum RadarVisibility
DISTORTED //!< Visible but not fully
};

enum class RadarIconMode {
Off = 0,
On = 1,
TargetOnly = 2
};
extern RadarIconMode Radar_2d_icon_mode;

void radar_frame_init();
void radar_mission_init();
void radar_plot_object( object *objp );
RadarVisibility radar_is_visible( object *objp );
void radar_check_2d_icon_options();

extern sound_handle Radar_static_looping;

Expand Down
2 changes: 2 additions & 0 deletions code/ship/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6752,6 +6752,8 @@ void ship_init()

// We shouldn't already have any subsystem pointers at this point.
Assertion(Ship_subsystems.empty(), "Some pre-allocated subsystems didn't get cleared out: " SIZE_T_ARG " batches present during ship_init(); get a coder!\n", Ship_subsystems.size());

radar_check_2d_icon_options();
}
}

Expand Down
Loading