Remove the global TextStyle; this should fix some of the textual glitches
This commit is contained in:
@@ -603,10 +603,9 @@ void do_explosion_anim(short sound_num,short special_draw)
|
||||
temp_rect = RECT(terrain_screen_gworld);
|
||||
active_area_rect = temp_rect;
|
||||
active_area_rect.inset(13,13);
|
||||
// TODO: Deglobalize this
|
||||
TEXT.font = "Geneva";
|
||||
TEXT.style = sf::Text::Bold;
|
||||
TEXT.pointSize = 10;
|
||||
TextStyle style;
|
||||
style.font = FONT_BOLD;
|
||||
style.pointSize = 10;
|
||||
temp_gworld.create(temp_rect.width(), temp_rect.height());
|
||||
temp_gworld.setActive();
|
||||
clip_rect(temp_gworld, active_area_rect);
|
||||
@@ -667,9 +666,10 @@ void do_explosion_anim(short sound_num,short special_draw)
|
||||
if (store_booms[i].val_to_place < 10)
|
||||
text_rect.left += 8;
|
||||
sprintf(str,"%d",store_booms[i].val_to_place);
|
||||
TEXT.colour = sf::Color::White;
|
||||
win_draw_string(temp_gworld,text_rect,str,1,12);
|
||||
TEXT.colour = sf::Color::Black;
|
||||
style.colour = sf::Color::White;
|
||||
style.lineHeight = 12;
|
||||
win_draw_string(temp_gworld,text_rect,str,1,style);
|
||||
style.colour = sf::Color::Black;
|
||||
mainPtr.setActive();
|
||||
}
|
||||
}
|
||||
@@ -766,9 +766,9 @@ void draw_shop_graphics(bool pressed,RECT clip_area_rect)
|
||||
}
|
||||
|
||||
talk_gworld.setActive();
|
||||
TEXT.font = "Dungeon";
|
||||
TEXT.pointSize = 18;
|
||||
TEXT.style = sf::Text::Regular;
|
||||
TextStyle style;
|
||||
style.font = FONT_DUNGEON;
|
||||
style.pointSize = 18;
|
||||
|
||||
talk_gworld.setActive();
|
||||
if (pressed) {
|
||||
@@ -792,19 +792,19 @@ void draw_shop_graphics(bool pressed,RECT clip_area_rect)
|
||||
|
||||
|
||||
// Place name of store and shopper name
|
||||
TEXT.colour = c[3];
|
||||
style.colour = c[3];
|
||||
style.lineHeight = 18;
|
||||
dest_rect = title_rect;
|
||||
dest_rect.offset(1,1);
|
||||
win_draw_string(talk_gworld,dest_rect,store_store_name,2,18);
|
||||
win_draw_string(talk_gworld,dest_rect,store_store_name,2,style);
|
||||
dest_rect.offset(-1,-1);
|
||||
TEXT.colour = c[4];
|
||||
win_draw_string(talk_gworld,dest_rect,store_store_name,2,18);
|
||||
style.colour = c[4];
|
||||
win_draw_string(talk_gworld,dest_rect,store_store_name,2,style);
|
||||
|
||||
TEXT.font = "Geneva";
|
||||
TEXT.pointSize = 12;;
|
||||
TEXT.style = sf::Text::Bold;
|
||||
style.font = FONT_BOLD;
|
||||
style.pointSize = 12;
|
||||
|
||||
TEXT.colour = c[3];
|
||||
style.colour = c[3];
|
||||
switch (store_shop_type) {
|
||||
case 3: sprintf(cur_name,"Healing for %s.",univ.party[current_pc].name.c_str()); break;
|
||||
case 10: sprintf(cur_name,"Mage Spells for %s.",univ.party[current_pc].name.c_str());break;
|
||||
@@ -813,10 +813,9 @@ void draw_shop_graphics(bool pressed,RECT clip_area_rect)
|
||||
case 4: sprintf(cur_name,"Buying Food.");break;
|
||||
default:sprintf(cur_name,"Shopping for %s.",univ.party[current_pc].name.c_str()); break;
|
||||
}
|
||||
win_draw_string(talk_gworld,shopper_name,cur_name,2,18);
|
||||
win_draw_string(talk_gworld,shopper_name,cur_name,2,style);
|
||||
|
||||
// Place help and done buttons
|
||||
TEXT.colour = sf::Color::Black;
|
||||
// TODO: Reimplement these with a cButton
|
||||
#if 0
|
||||
help_from = RECT(dlg_buttons_gworld[3][0]); // help
|
||||
@@ -830,8 +829,8 @@ void draw_shop_graphics(bool pressed,RECT clip_area_rect)
|
||||
#endif
|
||||
|
||||
if (pressed)
|
||||
TEXT.colour = c[4];
|
||||
else TEXT.colour = sf::Color::Black;
|
||||
style.colour = c[4];
|
||||
else style.colour = sf::Color::Black;
|
||||
|
||||
// Place all the items
|
||||
for (i = 0; i < 8; i++) {
|
||||
@@ -901,29 +900,28 @@ void draw_shop_graphics(bool pressed,RECT clip_area_rect)
|
||||
// Now draw item shopping_rects[i][7]
|
||||
// 0 - whole area, 1 - active area 2 - graphic 3 - item name
|
||||
// 4 - item cost 5 - item extra str 6 - item help button
|
||||
TEXT.pointSize = 12;
|
||||
win_draw_string(talk_gworld,shopping_rects[i][3],cur_name,0,12);
|
||||
style.pointSize = 12;
|
||||
style.lineHeight = 12;
|
||||
win_draw_string(talk_gworld,shopping_rects[i][3],cur_name,0,style);
|
||||
sprintf(cur_name,"Cost: %d",cur_cost);
|
||||
win_draw_string(talk_gworld,shopping_rects[i][4],cur_name,0,12);
|
||||
TEXT.pointSize = 10;
|
||||
win_draw_string(talk_gworld,shopping_rects[i][5],cur_info_str,0,12);
|
||||
win_draw_string(talk_gworld,shopping_rects[i][4],cur_name,0,style);
|
||||
style.pointSize = 10;
|
||||
win_draw_string(talk_gworld,shopping_rects[i][5],cur_info_str,0,style);
|
||||
if ((store_shop_type != 3) && (store_shop_type != 4))
|
||||
rect_draw_some_item(invenbtn_gworld,item_info_from,talk_gworld,shopping_rects[i][6],pressed ? sf::BlendNone : sf::BlendAlpha);
|
||||
|
||||
}
|
||||
|
||||
// Finally, cost info and help strs
|
||||
TEXT.pointSize = 12;
|
||||
sprintf(cur_name,"Prices here are %s.",cost_strs[store_cost_mult]);
|
||||
TEXT.pointSize = 10;
|
||||
win_draw_string(talk_gworld,bottom_help_rects[0],cur_name,0,12);
|
||||
win_draw_string(talk_gworld,bottom_help_rects[1],"Click on item name (or type 'a'-'h') to buy.",0,12);
|
||||
win_draw_string(talk_gworld,bottom_help_rects[2],"Hit done button (or Esc.) to quit.",0,12);
|
||||
style.pointSize = 10;
|
||||
style.lineHeight = 12;
|
||||
win_draw_string(talk_gworld,bottom_help_rects[0],cur_name,0,style);
|
||||
win_draw_string(talk_gworld,bottom_help_rects[1],"Click on item name (or type 'a'-'h') to buy.",0,style);
|
||||
win_draw_string(talk_gworld,bottom_help_rects[2],"Hit done button (or Esc.) to quit.",0,style);
|
||||
if ((store_shop_type != 3) && (store_shop_type != 4))
|
||||
win_draw_string(talk_gworld,bottom_help_rects[3],"'I' button brings up description.",0,12);
|
||||
win_draw_string(talk_gworld,bottom_help_rects[3],"'I' button brings up description.",0,style);
|
||||
|
||||
|
||||
TEXT.colour = sf::Color::Black;
|
||||
undo_clip(talk_gworld);
|
||||
talk_gworld.display();
|
||||
|
||||
@@ -1091,9 +1089,9 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
|
||||
|
||||
talk_gworld.setActive();
|
||||
|
||||
TEXT.font = "Dungeon";
|
||||
TEXT.pointSize = 18;
|
||||
TEXT.style = sf::Text::Regular;
|
||||
TextStyle style;
|
||||
style.font = FONT_DUNGEON;
|
||||
style.pointSize = 18;
|
||||
|
||||
if (c_rect.right > 0) {
|
||||
mainPtr.setActive();
|
||||
@@ -1139,22 +1137,23 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
|
||||
talk_gworld.setActive();
|
||||
}
|
||||
// Place name oftalkee
|
||||
TEXT.colour = c[3];
|
||||
style.colour = c[3];
|
||||
style.lineHeight = 18;
|
||||
dest_rect = title_rect;
|
||||
dest_rect.offset(1,1);
|
||||
win_draw_string(talk_gworld,dest_rect,title_string,2,18);
|
||||
win_draw_string(talk_gworld,dest_rect,title_string,2,style);
|
||||
dest_rect.offset(-1,-1);
|
||||
TEXT.colour = c[4];
|
||||
win_draw_string(talk_gworld,dest_rect,title_string,2,18);
|
||||
style.colour = c[4];
|
||||
win_draw_string(talk_gworld,dest_rect,title_string,2,style);
|
||||
|
||||
// Place buttons at bottom.
|
||||
if (color == 0)
|
||||
TEXT.colour = c[5];
|
||||
else TEXT.colour = c[6];
|
||||
style.colour = c[5];
|
||||
else style.colour = c[6];
|
||||
for (i = 0; i < 9; i++)
|
||||
if ((talk_end_forced == false) || (i == 6) || (i == 5)) {
|
||||
preset_words[i].word_rect.offset(0,8);
|
||||
win_draw_string(talk_gworld,preset_words[i].word_rect,preset_words[i].word,2,18);
|
||||
win_draw_string(talk_gworld,preset_words[i].word_rect,preset_words[i].word,2,style);
|
||||
preset_words[i].word_rect.offset(0,-8);
|
||||
}
|
||||
// Place bulk of what said. Save words.
|
||||
@@ -1179,11 +1178,12 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
|
||||
current_rect = 0;
|
||||
|
||||
if (color == 0)
|
||||
TEXT.colour = c[2];
|
||||
else TEXT.colour = c[1];
|
||||
TEXT.applyTo(str_to_draw);
|
||||
style.colour = c[2];
|
||||
else style.colour = c[1];
|
||||
style.lineHeight = line_height;
|
||||
style.applyTo(str_to_draw);
|
||||
// TODO: The entire text flashes when clicking anything
|
||||
win_draw_string(talk_gworld, dest_rect, str, 0, line_height);
|
||||
win_draw_string(talk_gworld, dest_rect, str, 0, style);
|
||||
for (i = 0;i < str_len;i++) {
|
||||
if (((str[i] != 39) && ((str[i] < 65) || (str[i] > 122)) && ((str[i] < 48) || (str[i] > 57))) && (color == 0)) { // New word, so set up a rect
|
||||
if (((i - store_last_word_break >= 4) || (i >= str_len - 1))
|
||||
@@ -1254,7 +1254,7 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
|
||||
str_to_draw.setString(str);
|
||||
|
||||
last_line_break = store_last_word_break = last_word_break = last_stored_word_break = 0;
|
||||
win_draw_string(talk_gworld, dest_rect, str, 0, line_height);
|
||||
win_draw_string(talk_gworld, dest_rect, str, 0, style);
|
||||
for (i = 0;i < str_len;i++) {
|
||||
if (((str[i] != 39) && ((str[i] < 65) || (str[i] > 122)) && ((str[i] < 48) || (str[i] > 57))) && (color == 0)) { // New word, so set up a rect
|
||||
if (((i - store_last_word_break >= 4) || (i >= str_len - 1))
|
||||
@@ -1312,7 +1312,6 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
|
||||
}
|
||||
}
|
||||
|
||||
TEXT.colour = sf::Color::Black;
|
||||
RECT oldRect(talk_gworld);
|
||||
undo_clip(talk_gworld);
|
||||
talk_gworld.display();
|
||||
|
||||
Reference in New Issue
Block a user