boe.newgraph.cpp: try to improve the lighting,

pc.main.cpp,scen.main.cpp: do not change the mac icon
boe.actions.cpp: correct a recent problem with new escape keyevents
+ minors cleaning
This commit is contained in:
ALONSO Laurent
2021-10-10 13:47:54 +02:00
committed by Celtic Minstrel
parent 4885ead643
commit 17ba320d65
8 changed files with 17 additions and 21 deletions

View File

@@ -1593,7 +1593,9 @@ bool handle_keystroke(const sf::Event& event){
abort = false;
if (abort) {
play_sound(37);
add_string_to_buf("Cancelled.");
add_string_to_buf(" Cancelled.");
if (overall_mode==MODE_COMBAT)
center = univ.current_pc().combat_pos;
print_buf();
obscureCursor();
return false;

View File

@@ -52,7 +52,6 @@ extern location center;
extern std::shared_ptr<cScrollbar> text_sbar,item_sbar,shop_sbar;
extern std::shared_ptr<cButton> done_btn, help_btn;
extern bool map_visible;
extern sf::RenderWindow mini_map;
extern cUniverse univ;
extern sf::Texture pc_gworld;
extern std::map<eSkill,short> skill_max;

View File

@@ -756,7 +756,7 @@ void draw_terrain(short mode) {
where_draw.x += i - 6;
where_draw.y += j - 6;
if(!(is_out()))
light_area[i][j] = (is_town()) ? (can_see_light(view_loc,where_draw,sight_obscurity)<=4) : combat_pt_in_light(where_draw);
light_area[i][j] = is_town() ? can_see_light(view_loc,where_draw,sight_obscurity)<=4 : combat_pt_in_light(where_draw);
if((where_draw.x < 0) || (where_draw.x > max_dim - 1)
|| (where_draw.y < 0) || (where_draw.y > max_dim - 1))
unexplored_area[i][j] = 0;

View File

@@ -30,7 +30,6 @@ extern eGameMode overall_mode;
extern short current_spell_range;
extern cUniverse univ;
extern effect_pat_type current_pat;
extern sf::RenderWindow mini_map;
extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x
extern sf::RenderTexture terrain_screen_gworld;

View File

@@ -155,7 +155,9 @@ void apply_unseen_mask() {
void apply_light_mask(bool onWindow) {
static Region dark_mask_region;
rectangle temp = {0,0,108,84},paint_rect,base_rect = {0,0,36,28};
rectangle big_to = {13,13,337,265};
// I correct the values to make the display ok
// but I am not sure what are the correct values
rectangle big_to = {13+2,13+14,337+3,265+15};
bool same_mask = true;
if(!get_bool_pref("DrawTerrainFrills", true) || fog_lifted)
return;
@@ -174,18 +176,16 @@ void apply_light_mask(bool onWindow) {
// Process the light array
for(short i = 1; i < 12; i++)
for(short j = 1; j < 12; j++)
if((light_area[i - 1][j - 1] >= 1) && (light_area[i + 1][j - 1] >= 1) &&
(light_area[i - 1][j] >= 1) && (light_area[i + 1][j] >= 1) &&
(light_area[i - 1][j + 1] >= 1) && (light_area[i + 1][j + 1] >= 1) &&
(light_area[i][j - 1] >= 1) && (light_area[i][j + 1] >= 1)) {
if(light_area[i-1][j-1] >= 1 && light_area[i][j-1] >= 1 && light_area[i+1][j-1]>=1 &&
light_area[i-1][j+0] >= 1 && light_area[i][j+0] >= 1 && light_area[i+1][j+0]>=1 &&
light_area[i-1][j+1] >= 1 && light_area[i][j+1] >= 1 && light_area[i+1][j+1]>=1) {
light_area[i][j] = 2;
}
for(short i = 1; i < 12; i++)
for(short j = 1; j < 12; j++)
if((light_area[i - 1][j - 1] >= 2) && (light_area[i + 1][j - 1] >= 2) &&
(light_area[i - 1][j] >= 2) && (light_area[i + 1][j] >= 2) &&
(light_area[i - 1][j + 1] >= 2) && (light_area[i + 1][j + 1] >= 2) &&
(light_area[i][j - 1] >= 2) && (light_area[i][j + 1] >= 2)) {
if(light_area[i-1][j-1] >= 2 && light_area[i][j-1] >= 2 && light_area[i+1][j-1]>=2 &&
light_area[i-1][j+0] >= 2 && light_area[i][j+0] >= 2 && light_area[i+1][j+0]>=2 &&
light_area[i-1][j+1] >= 2 && light_area[i][j+1] >= 2 && light_area[i+1][j+1]>=2) {
light_area[i][j] = 3;
}
@@ -213,7 +213,8 @@ void apply_light_mask(bool onWindow) {
for(short i = 1; i < 12; i++)
for(short j = 1; j < 12; j++) {
if(light_area[i][j] == 2) {
int xOffset = 13 + 28 * (i - 3), yOffset = 13 + 36 * (j - 3);
// UNSURE WHY 28+...,18+... seems to gives better result that 13+...,13+...
int xOffset = 28 + 28 * (i - 3), yOffset = 18 + 36 * (j - 3);
Region oval_region;
oval_region.addEllipse(temp);
oval_region.offset(xOffset, yOffset);

View File

@@ -1214,11 +1214,6 @@ bool does_location_have_special(cOutdoors& sector, location loc, eTerSpec specia
void clear_map() {
rectangle map_world_rect(map_gworld);
// if(!map_visible) {
// return;
// }
// draw_map(mini_map,11);
fill_rect(map_gworld, map_world_rect, sf::Color::Black);
}

View File

@@ -169,7 +169,7 @@ void adjust_window (sf::RenderWindow& mainPtr, sf::View& mainView) {
// Apply view to the main window
mainPtr.setView(mainView);
#ifndef SFML_SYSTEM_MAC // This overrides Dock icon on OSX, which isn't what we want at all
#ifndef __APPLE__ // This overrides Dock icon on OSX, which isn't what we want at all
auto const & icon = *ResMgr::textures.get("icon", true);
mainPtr.setIcon(icon->getSize().x, icon->getSize().y, icon->copyToImage().getPixelsPtr());
#endif

View File

@@ -190,7 +190,7 @@ void adjust_windows (sf::RenderWindow & mainPtr, sf::View & mainView) {
// Apply view to the main window
mainPtr.setView(mainView);
#ifndef SFML_SYSTEM_MAC // This overrides Dock icon on OSX, which isn't what we want at all
#ifndef __APPLE__ // This overrides Dock icon on OSX, which isn't what we want at all
auto const & icon = *ResMgr::textures.get("icon", true);
mainPtr.setIcon(icon->getSize().x, icon->getSize().y, icon->copyToImage().getPixelsPtr());
#endif