refactor dialogue word button on/off colors to constants

This commit is contained in:
2024-08-29 23:23:01 -05:00
committed by Celtic Minstrel
parent 9b862d848f
commit 7791380a9a
3 changed files with 14 additions and 7 deletions

View File

@@ -603,8 +603,8 @@ void start_talk_mode(short m_num,short personality,mon_num_t monst_type,short st
// Place buttons at bottom.
for(short i = 0; i < 9; i++) {
word_rect_t preset_word(preset_words[i], preset_rects[i]);
preset_word.on = Colours::DARK_GREEN;
preset_word.off = Colours::LIGHT_GREEN;
preset_word.on = PRESET_WORD_ON;
preset_word.off = PRESET_WORD_OFF;
switch(i) {
case 0: preset_word.node = TALK_LOOK; break;
case 1: preset_word.node = TALK_NAME; break;

View File

@@ -878,9 +878,9 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
// Place buttons at bottom.
if(color == 0)
style.colour = Colours::DARK_GREEN;
style.colour = PRESET_WORD_OFF;
else
style.colour = Colours::LIGHT_GREEN;
style.colour = PRESET_WORD_ON;
for(short i = 0; i < 9; i++) {
if(!talk_end_forced || i == 6 || i == 5)
win_draw_string(talk_gworld,talk_words[i].rect,talk_words[i].word,eTextMode::LEFT_TOP,style);
@@ -907,7 +907,7 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
}
}
std::vector<rectangle> word_rects = draw_string_hilite(talk_gworld, word_place_rect, str, style, hilites, color ? Colours::DARK_BLUE : Colours::DARK_RED);
std::vector<rectangle> word_rects = draw_string_hilite(talk_gworld, word_place_rect, str, style, hilites, color ? CUSTOM_WORD_ON : CUSTOM_WORD_OFF);
if(!talk_end_forced) {
// Now build the list of word rects
@@ -916,8 +916,8 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
thisRect.word = str.substr(hilites[i].first, hilites[i].second - hilites[i].first);
thisRect.rect = word_rects[i];
thisRect.node = nodes[i];
thisRect.on = Colours::DARK_BLUE;
thisRect.off = Colours::NAVY; // Note: "off" is never used
thisRect.on = CUSTOM_WORD_ON;
thisRect.off = CUSTOM_WORD_OFF; // Note: "off" is never used
talk_words.push_back(thisRect);
}
}

View File

@@ -66,4 +66,11 @@ namespace Colours {
const sf::Color DARK_RED { 0xa0, 0x00, 0x14}; // formerly c[7] (clickable text, new in OBoE)
}
const sf::Color PRESET_WORD_ON = Colours::DARK_GREEN;
const sf::Color PRESET_WORD_OFF = Colours::LIGHT_GREEN;
const sf::Color CUSTOM_WORD_ON = Colours::DARK_BLUE;
const sf::Color CUSTOM_WORD_OFF = Colours::DARK_RED;
#endif