Several little tweaks and fixes
- Fix scroll wheel in terrain area going beyond section boundaries - Fix text not being drawn in dialog text fields when first activated - Fix terrain being painted while scrolling the map to the east (especially with the keypad) - Fix item or monster palette remaining active while editing outdoors - When using a large brush, hilite all affected spaces
This commit is contained in:
@@ -2175,8 +2175,8 @@ bool handle_scroll(sf::Event& event) {
|
||||
redraw_screen(REFRESH_DLOG);
|
||||
} else if(scrollableModes.count(overall_mode) && pos.in(world_screen)) {
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) || sf::Keyboard::isKeyPressed(sf::Keyboard::RControl))
|
||||
center.x -= amount;
|
||||
else center.y -= amount;
|
||||
center.x = minmax(4, univ.town->max_dim() - 5, center.x - amount);
|
||||
else center.y = minmax(4, univ.town->max_dim() - 5, center.y - amount);
|
||||
redraw_screen(REFRESH_TERRAIN);
|
||||
}
|
||||
return true;
|
||||
|
@@ -232,8 +232,8 @@ void cTextField::draw(){
|
||||
}
|
||||
}
|
||||
undo_clip(*inWindow);
|
||||
changeMade = false;
|
||||
}
|
||||
changeMade = false;
|
||||
clip_rect(*inWindow, frame);
|
||||
ip_col = ip_row = -1;
|
||||
if(haveFocus) {
|
||||
|
@@ -125,6 +125,7 @@ void init_screen_locs() {
|
||||
void update_mouse_spot(location the_point) {
|
||||
rectangle terrain_rect = world_screen;
|
||||
terrain_rect.inset(8,8);
|
||||
terrain_rect.right -= 4;
|
||||
if(terrain_rect.contains(the_point)) {
|
||||
if(cur_viewing_mode == 0) {
|
||||
mouse_spot.x = (the_point.x - TER_RECT_UL_X - 8) / 28;
|
||||
@@ -1531,8 +1532,8 @@ bool handle_scroll(sf::Event& event) {
|
||||
redraw_screen();
|
||||
} else if(overall_mode < MODE_MAIN_SCREEN && pos.in(world_screen)) {
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) || sf::Keyboard::isKeyPressed(sf::Keyboard::RControl))
|
||||
cen_x -= amount;
|
||||
else cen_y -= amount;
|
||||
cen_x = minmax(4, town->max_dim() - 5, cen_x - amount);
|
||||
else cen_y = minmax(4, town->max_dim() - 5, cen_y - amount);
|
||||
redraw_screen();
|
||||
}
|
||||
return true;
|
||||
@@ -2204,6 +2205,7 @@ void start_out_edit() {
|
||||
set_lb(NLS - 2,LB_TEXT,LB_NO_ACTION,"(Click border to scroll view.)");
|
||||
set_lb(NLS - 1,LB_TEXT,LB_RETURN,"Back to Main Menu");
|
||||
overall_mode = MODE_DRAWING;
|
||||
draw_mode = DRAW_TERRAIN;
|
||||
editing_town = false;
|
||||
set_up_terrain_buttons(true);
|
||||
right_sbar->hide();
|
||||
|
@@ -13,7 +13,6 @@
|
||||
|
||||
extern rectangle right_sbar_rect;
|
||||
|
||||
rectangle left_button[NLS];
|
||||
extern rectangle right_buttons[NRSONPAGE];
|
||||
rectangle right_scrollbar_rect;
|
||||
extern short current_rs_top;
|
||||
|
@@ -45,7 +45,6 @@ extern bool editing_town;
|
||||
extern cScenario scenario;
|
||||
extern rectangle world_screen;
|
||||
extern sf::Texture bg_gworld;
|
||||
extern rectangle left_button[NLS];
|
||||
extern rectangle right_buttons[NRSONPAGE];
|
||||
extern rectangle right_scrollbar_rect;
|
||||
extern std::shared_ptr<cScrollbar> right_sbar, pal_sbar;
|
||||
@@ -93,7 +92,7 @@ extern ePalBtn town_buttons[6][10], out_buttons[6][10];
|
||||
rectangle palette_button_base = {0,0,18,25};
|
||||
rectangle terrain_buttons_rect = {0,0,410,294};
|
||||
extern rectangle left_buttons[NLS][2]; // 0 - whole, 1 - blue button
|
||||
rectangle left_button_base = {5,5,21,200};
|
||||
rectangle left_button_base = {5,5,21,280};
|
||||
rectangle right_button_base = {RIGHT_AREA_UL_Y,RIGHT_AREA_UL_X,17,RIGHT_AREA_UL_Y};
|
||||
rectangle terrain_rect = {0,0,340,272};
|
||||
char current_string[256] = "";
|
||||
@@ -887,13 +886,30 @@ void draw_terrain(){
|
||||
}
|
||||
|
||||
}
|
||||
if(where_draw == mouse_spot) {
|
||||
rectangle destrec;
|
||||
destrec.left = 8 + BITMAP_WIDTH * where_draw.x;
|
||||
destrec.right = destrec.left + BITMAP_WIDTH;
|
||||
destrec.top = 8 + BITMAP_HEIGHT * where_draw.y;
|
||||
destrec.bottom = destrec.top + BITMAP_HEIGHT;
|
||||
fill_rect(ter_draw_gworld, destrec, hilite_colour);
|
||||
if(mouse_spot.x >= 0 && mouse_spot.y >= 0) {
|
||||
bool need_hilite = false, large_hilite = false;
|
||||
int d = dist(where_draw, mouse_spot);
|
||||
if(overall_mode == MODE_SMALL_PAINTBRUSH && d <= 1) {
|
||||
need_hilite = true;
|
||||
large_hilite = true;
|
||||
} else if((overall_mode == MODE_ERASER || overall_mode == MODE_SMALL_SPRAYCAN) && d <= 2) {
|
||||
need_hilite = true;
|
||||
large_hilite = true;
|
||||
} else if((overall_mode == MODE_LARGE_PAINTBRUSH || overall_mode == MODE_LARGE_SPRAYCAN) && d <= 4) {
|
||||
need_hilite = true;
|
||||
large_hilite = true;
|
||||
} else if(where_draw == mouse_spot)
|
||||
need_hilite = true;
|
||||
if(need_hilite) {
|
||||
rectangle destrec;
|
||||
destrec.left = 8 + BITMAP_WIDTH * where_draw.x;
|
||||
destrec.right = destrec.left + BITMAP_WIDTH;
|
||||
destrec.top = 8 + BITMAP_HEIGHT * where_draw.y;
|
||||
destrec.bottom = destrec.top + BITMAP_HEIGHT;
|
||||
fill_rect(ter_draw_gworld, destrec, hilite_colour);
|
||||
if(large_hilite && where_draw == mouse_spot)
|
||||
fill_rect(ter_draw_gworld, destrec, hilite_colour);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(editing_town) {
|
||||
@@ -1176,8 +1192,26 @@ void draw_one_tiny_terrain_spot (short i,short j,ter_num_t terrain_to_draw,short
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(loc(i,j) == mouse_spot) {
|
||||
fill_rect(ter_draw_gworld, dest_rect, hilite_colour);
|
||||
if(mouse_spot.x >= 0 && mouse_spot.y >= 0) {
|
||||
location where_draw(i,j);
|
||||
bool need_hilite = false, large_hilite = false;
|
||||
int d = dist(where_draw, mouse_spot);
|
||||
if(overall_mode == MODE_SMALL_PAINTBRUSH && d <= 1) {
|
||||
need_hilite = true;
|
||||
large_hilite = true;
|
||||
} else if((overall_mode == MODE_ERASER || overall_mode == MODE_SMALL_SPRAYCAN) && d <= 2) {
|
||||
need_hilite = true;
|
||||
large_hilite = true;
|
||||
} else if((overall_mode == MODE_LARGE_PAINTBRUSH || overall_mode == MODE_LARGE_SPRAYCAN) && d <= 4) {
|
||||
need_hilite = true;
|
||||
large_hilite = true;
|
||||
} else if(where_draw == mouse_spot)
|
||||
need_hilite = true;
|
||||
if(need_hilite) {
|
||||
fill_rect(ter_draw_gworld, dest_rect, hilite_colour);
|
||||
if(large_hilite && where_draw == mouse_spot)
|
||||
fill_rect(ter_draw_gworld, dest_rect, hilite_colour);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user