Skip to content

Commit

Permalink
Merge pull request #78053 from Procyonae/CreatureOverlayIconsOption
Browse files Browse the repository at this point in the history
Make creature overlay icons optional
  • Loading branch information
Night-Pryanik authored Nov 22, 2024
2 parents a3ac7b6 + 040cf52 commit d42cfd9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/cached_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ bool prevent_occlusion_retract;
bool prevent_occlusion_transp;
float prevent_occlusion_min_dist;
float prevent_occlusion_max_dist;
bool show_creature_overlay_icons;
bool use_tiles;
bool use_far_tiles;
bool use_pinyin_search;
Expand Down
1 change: 1 addition & 0 deletions src/cached_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extern bool prevent_occlusion_retract;
extern bool prevent_occlusion_transp;
extern float prevent_occlusion_min_dist;
extern float prevent_occlusion_max_dist;
extern bool show_creature_overlay_icons;
extern bool use_tiles;
extern bool use_far_tiles;
extern bool use_pinyin_search;
Expand Down
2 changes: 1 addition & 1 deletion src/cata_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4121,7 +4121,7 @@ bool cata_tiles::draw_critter_at( const tripoint &p, lit_level ll, int &height_3
}
}

if( result && !is_player ) {
if( result && !is_player && show_creature_overlay_icons ) {
std::string draw_id = "overlay_" + Creature::attitude_raw_string( attitude );
if( sees_player && !you.has_trait( trait_INATTENTIVE ) ) {
draw_id += "_sees_player";
Expand Down
16 changes: 8 additions & 8 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3426,10 +3426,11 @@ std::vector<std::pair<std::string, std::string>> Character::get_overlay_ids() co
int order;
std::string overlay_id;
std::string variant;

// first get effects
for( const auto &eff_pr : *effects ) {
rval.emplace_back( "effect_" + eff_pr.first.str(), "" );
if( show_creature_overlay_icons ) {
for( const auto &eff_pr : *effects ) {
rval.emplace_back( "effect_" + eff_pr.first.str(), "" );
}
}

// then get mutations
Expand Down Expand Up @@ -3478,7 +3479,7 @@ std::vector<std::pair<std::string, std::string>> Character::get_overlay_ids() co
rval.emplace_back( "wielded_" + weapon.typeId().str(), variant );
}

if( !is_walking() ) {
if( !is_walking() && show_creature_overlay_icons ) {
rval.emplace_back( move_mode.str(), "" );
}

Expand All @@ -3489,10 +3490,9 @@ std::vector<std::pair<std::string, std::string>> Character::get_overlay_ids_when
const
{
std::vector<std::pair<std::string, std::string>> rval;
std::multimap<int, std::pair<std::string, std::string>> mutation_sorting;
std::string overlay_id;
std::string variant;

if( !show_creature_overlay_icons ) {
return rval;
}
// first get effects
for( const auto &eff_pr : *effects ) {
rval.emplace_back( "effect_" + eff_pr.first.str(), "" );
Expand Down
7 changes: 7 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2429,6 +2429,11 @@ void options_manager::add_options_graphics()
build_tilesets_list(), "UltimateCataclysm", COPT_CURSES_HIDE
); // populate the options dynamically

add( "CREATURE_OVERLAY_ICONS", page_id, to_translation( "Show overlay icons over creatures" ),
to_translation( "If true, show overlay icons over creatures such as effects, move mode and whether creatures can see the player." ),
true, COPT_CURSES_HIDE
);

add( "SWAP_ZOOM", page_id, to_translation( "Zoom Threshold" ),
to_translation( "Choose when you should swap tileset (lower is more zoomed out)." ),
1, 4, 2, COPT_CURSES_HIDE
Expand All @@ -2438,6 +2443,7 @@ void options_manager::add_options_graphics()
get_option( "USE_DISTANT_TILES" ).setPrerequisite( "USE_TILES" );
get_option( "DISTANT_TILES" ).setPrerequisite( "USE_DISTANT_TILES" );
get_option( "SWAP_ZOOM" ).setPrerequisite( "USE_DISTANT_TILES" );
get_option( "CREATURE_OVERLAY_ICONS" ).setPrerequisite( "USE_TILES" );

add( "USE_OVERMAP_TILES", page_id, to_translation( "Use tiles to display overmap" ),
to_translation( "If true, replaces some TTF-rendered text with tiles for overmap display." ),
Expand Down Expand Up @@ -4101,6 +4107,7 @@ void options_manager::update_options_cache()
prevent_occlusion_transp = ::get_option<bool>( "PREVENT_OCCLUSION_TRANSP" );
prevent_occlusion_min_dist = ::get_option<float>( "PREVENT_OCCLUSION_MIN_DIST" );
prevent_occlusion_max_dist = ::get_option<float>( "PREVENT_OCCLUSION_MAX_DIST" );
show_creature_overlay_icons = ::get_option<bool>( "CREATURE_OVERLAY_ICONS" );

// if the tilesets are identical don't duplicate
use_far_tiles = ::get_option<bool>( "USE_DISTANT_TILES" ) ||
Expand Down

0 comments on commit d42cfd9

Please sign in to comment.