Skip to content

Commit

Permalink
Merge pull request CleverRaven#27721 from halfahermit/tiles-active-mu…
Browse files Browse the repository at this point in the history
…tation-overlay

Allow adding distinct tiles for activated mutation/bionics
  • Loading branch information
kevingranade authored Jan 20, 2019
2 parents 942cd8f + d8d11ed commit 16d9515
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
8 changes: 8 additions & 0 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,14 @@ Each tileset has a tile_config.json describing how to map the contents of a spri
{ "weight":1, "sprite":3621},
{ "weight":1, "sprite":3622}
]
},
{
"id": [
"overlay_mutation_GOURMAND", // character overlay for mutation
"overlay_mutation_male_GOURMAND", // overlay for specified gender
"overlay_mutation_active_GOURMAND" // overlay for activated mutation
],
"fg": 4040
}
]
},
Expand Down
18 changes: 17 additions & 1 deletion gfx/RetroDaysTileset/tile_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20911,6 +20911,22 @@
{
"id": "overlay_male_mutation_bio_deformity",
"fg": 2746
},
{
"id": "overlay_male_mutation_active_CLAWS_RETRACT",
"fg": 2747
},
{
"id": "overlay_male_mutation_CLAWS_RETRACT",
"fg": 2748
},
{
"id": "overlay_mutation_active_CLAWS_RETRACT",
"fg": 2749
},
{
"id": "overlay_mutation_CLAWS_RETRACT",
"fg": 2750
}
]
},
Expand Down Expand Up @@ -21024,4 +21040,4 @@
"order": 515
}
]
}
}
Binary file modified gfx/RetroDaysTileset/tiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/cata_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,7 @@ bool cata_tiles::find_overlay_looks_like( const bool male, const std::string &ov

std::string looks_like;
std::string over_type;

if( overlay.substr( 0, 5 ) == "worn_" ) {
looks_like = overlay.substr( 5 );
over_type = "worn_";
Expand All @@ -1753,6 +1754,10 @@ bool cata_tiles::find_overlay_looks_like( const bool male, const std::string &ov
exists = true;
break;
}
if( looks_like.substr( 0, 16 ) == "mutation_active_" ) {
looks_like = "mutation_" + looks_like.substr( 16 );
continue;
}
if( !item::type_is_defined( looks_like ) ) {
break;
}
Expand Down
14 changes: 9 additions & 5 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12125,22 +12125,26 @@ std::vector<std::string> player::get_overlay_ids() const
{
std::vector<std::string> rval;
std::multimap<int, std::string> mutation_sorting;
int order;
std::string overlay_id;

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

// then get mutations
for( auto &mutation : get_mutations() ) {
auto value = get_overlay_order_of_mutation( mutation.str());
mutation_sorting.insert( std::pair<int, std::string>( value, mutation.str() ) );
for( const auto &mut : my_mutations ) {
overlay_id = ( mut.second.powered ? "active_" : "" ) + mut.first.str();
order = get_overlay_order_of_mutation( overlay_id );
mutation_sorting.insert( std::pair<int, std::string>( order, overlay_id ) );
}

// then get bionics
for( const bionic &bio : *my_bionics ) {
auto value = get_overlay_order_of_mutation( bio.id.str() );
mutation_sorting.insert( std::pair<int, std::string>( value, bio.id.str() ) );
overlay_id = ( bio.powered ? "active_" : "" ) + bio.id.str();
order = get_overlay_order_of_mutation( overlay_id );
mutation_sorting.insert( std::pair<int, std::string>( order, overlay_id ) );
}

for( auto &mutorder : mutation_sorting ) {
Expand Down

0 comments on commit 16d9515

Please sign in to comment.