From 7791380a9affb2e416cb100727991007161204f0 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Thu, 29 Aug 2024 23:23:01 -0500 Subject: [PATCH] refactor dialogue word button on/off colors to constants --- src/game/boe.dlgutil.cpp | 4 ++-- src/game/boe.newgraph.cpp | 10 +++++----- src/gfx/render_shapes.hpp | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/game/boe.dlgutil.cpp b/src/game/boe.dlgutil.cpp index 1bb80871..02e548dc 100644 --- a/src/game/boe.dlgutil.cpp +++ b/src/game/boe.dlgutil.cpp @@ -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; diff --git a/src/game/boe.newgraph.cpp b/src/game/boe.newgraph.cpp index ac4075aa..25936c7a 100644 --- a/src/game/boe.newgraph.cpp +++ b/src/game/boe.newgraph.cpp @@ -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 word_rects = draw_string_hilite(talk_gworld, word_place_rect, str, style, hilites, color ? Colours::DARK_BLUE : Colours::DARK_RED); + std::vector 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); } } diff --git a/src/gfx/render_shapes.hpp b/src/gfx/render_shapes.hpp index bf5d2959..20ca52a3 100644 --- a/src/gfx/render_shapes.hpp +++ b/src/gfx/render_shapes.hpp @@ -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