fix invisible clickable preset words when end forced

This commit is contained in:
2025-05-05 12:19:56 -05:00
parent cdb5b01657
commit 93d8e0054e
2 changed files with 15 additions and 10 deletions

View File

@@ -648,6 +648,8 @@ static void reset_talk_words() {
// Place buttons at bottom.
for(short i = 0; i < preset_words.size(); i++) {
if(talk_end_forced && i != 6 && i != 5) continue;
std::string word = preset_words[i];
location tl = preset_word_locs[i];
location br = tl;
@@ -1185,6 +1187,7 @@ void handle_talk_node(int which_talk_entry) {
}
place_talk_str(save_talk_str1,save_talk_str2,0,dummy_rect);
reset_talk_words();
}
bool handle_talk_event(location p, cFramerateLimiter& fps_limiter) {

View File

@@ -991,16 +991,18 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
std::vector<hilite_t> hilites;
std::vector<int> nodes;
int wordStart = 0, wordEnd = 0;
for(size_t i = 0; i < str.length(); i++) {
char c = str[i];
if(isalpha(c) || c == '-' || c == '\'') {
if(wordStart <= wordEnd) wordStart = i;
} else if(wordEnd <= wordStart) {
wordEnd = i;
short node = scan_for_response(str.c_str() + wordStart);
if(node >= 0) {
nodes.push_back(node);
hilites.push_back({wordStart, wordEnd});
if(!talk_end_forced){
for(size_t i = 0; i < str.length(); i++) {
char c = str[i];
if(isalpha(c) || c == '-' || c == '\'') {
if(wordStart <= wordEnd) wordStart = i;
} else if(wordEnd <= wordStart) {
wordEnd = i;
short node = scan_for_response(str.c_str() + wordStart);
if(node >= 0) {
nodes.push_back(node);
hilites.push_back({wordStart, wordEnd});
}
}
}
}