game: try to fix some details:
- always add help node in talk mode, - in shop/talk mode do no try to find a combat frame, ... - add a framerate_limiters in various loops of events, - try to improve the minimap update.
This commit is contained in:
@@ -1067,13 +1067,13 @@ bool handle_action(const sf::Event& event) {
|
||||
if(overall_mode != MODE_TALKING)
|
||||
return false;
|
||||
}
|
||||
if(overall_mode == MODE_SHOPPING) {
|
||||
else if(overall_mode == MODE_SHOPPING) {
|
||||
handle_shop_event(the_point);
|
||||
if(overall_mode != MODE_SHOPPING)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise they're in a terrain view mode
|
||||
else {
|
||||
location cur_loc = is_out() ? univ.party.out_loc : center;
|
||||
auto button_hit = UI::toolbar.button_hit(mainPtr, the_point);
|
||||
|
||||
@@ -1269,6 +1269,7 @@ bool handle_action(const sf::Event& event) {
|
||||
}
|
||||
}
|
||||
// MARK: End: Screen shift
|
||||
}
|
||||
|
||||
// MARK: Process clicks in PC stats area
|
||||
if(the_point.in(win_to_rects[WINRECT_PCSTATS])) {
|
||||
|
@@ -174,10 +174,6 @@ void end_shop_mode() {
|
||||
shop_sbar->hide();
|
||||
done_btn->hide();
|
||||
help_btn->hide();
|
||||
if(store_pre_shop_mode == MODE_TALKING) {
|
||||
place_talk_str("You conclude your business.", "", 0, dummy_rect);
|
||||
update_last_talk(TALK_BUSINESS);
|
||||
}
|
||||
|
||||
overall_mode = store_pre_shop_mode;
|
||||
if(overall_mode == MODE_TALK_TOWN)
|
||||
@@ -186,6 +182,14 @@ void end_shop_mode() {
|
||||
center = univ.party.town_loc;
|
||||
update_explored(center);
|
||||
}
|
||||
|
||||
if (overall_mode == MODE_TALKING) {
|
||||
// fixme: there must be a function to reset the talking state correctly
|
||||
place_talk_str("You conclude your business.", "", 0, dummy_rect);
|
||||
stat_screen_mode = MODE_SHOP;
|
||||
help_btn->show();
|
||||
}
|
||||
else
|
||||
stat_screen_mode = MODE_INVEN;
|
||||
put_item_screen(stat_window);
|
||||
put_pc_screen();
|
||||
|
@@ -607,10 +607,16 @@ void alter_space(short i,short j,ter_num_t ter) {
|
||||
location l(i,j);
|
||||
l = local_to_global(l);
|
||||
univ.out[l.x][l.y] = ter;
|
||||
if (univ.out->terrain[i][j] != ter) {
|
||||
univ.out->terrain[i][j] = ter;
|
||||
minimap::draw(true);
|
||||
}
|
||||
} else {
|
||||
ter_num_t former = univ.town->terrain(i,j);
|
||||
if (former!=ter) {
|
||||
univ.town->terrain(i,j) = ter;
|
||||
minimap::draw(true);
|
||||
}
|
||||
if(univ.scenario.ter_types[ter].special == eTerSpec::CONVEYOR)
|
||||
univ.town.belt_present = true;
|
||||
if(univ.scenario.ter_types[former].light_radius != univ.scenario.ter_types[ter].light_radius)
|
||||
|
@@ -93,6 +93,9 @@ void set_visible(bool vis)
|
||||
windows.setVisible(true);
|
||||
visible = true;
|
||||
draw(true);
|
||||
// when a game is loaded, the windows is not adapted correctly
|
||||
// try to force a new refresh
|
||||
changed = true;
|
||||
makeFrontWindow(mainPtr);
|
||||
|
||||
set_cursor(sword_curs);
|
||||
@@ -354,6 +357,9 @@ bool pollEvent()
|
||||
makeFrontWindow(mainPtr);
|
||||
else if(event.type == sf::Event::KeyPressed) {
|
||||
switch(event.key.code) {
|
||||
// checkme: the zone seems big enough
|
||||
// but maybe we can check for arrows here to move
|
||||
// in the zone
|
||||
case sf::Keyboard::Escape:
|
||||
set_visible(false);
|
||||
break;
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "strdlog.hpp"
|
||||
#include "choicedlog.hpp"
|
||||
#include "fileio.hpp"
|
||||
#include "framerate_limiter.hpp"
|
||||
#include "spell.hpp"
|
||||
#include "sounds.hpp"
|
||||
#include "universe.hpp"
|
||||
@@ -2006,9 +2007,11 @@ void run_special(eSpecCtx which_mode, eSpecCtxType which_type, spec_num_t start_
|
||||
add_string_to_buf(debug);
|
||||
redraw_screen(REFRESH_TRANS);
|
||||
sf::Event evt;
|
||||
cFramerateLimiter fps_limiter;
|
||||
while(true) {
|
||||
if(mainPtr.pollEvent(evt) && (evt.type == sf::Event::KeyPressed || evt.type == sf::Event::MouseButtonPressed))
|
||||
break;
|
||||
fps_limiter.frame_finished();
|
||||
}
|
||||
if(evt.type == sf::Event::KeyPressed && evt.key.code == sf::Keyboard::Escape)
|
||||
univ.node_step_through = false;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
|
||||
#include "boe.global.hpp"
|
||||
|
||||
#include "framerate_limiter.hpp"
|
||||
#include "universe.hpp"
|
||||
#include "boe.newgraph.hpp"
|
||||
#include "boe.graphics.hpp"
|
||||
@@ -124,15 +125,19 @@ void show_logo() {
|
||||
auto const &pict_to_draw = *ResMgr::textures.get("spidlogo", true);
|
||||
|
||||
play_sound(-95);
|
||||
cFramerateLimiter fps_limiter;
|
||||
while(sound_going(95)) {
|
||||
draw_splash(pict_to_draw, mainPtr, logo_from);
|
||||
handle_splash_events();
|
||||
fps_limiter.frame_finished();
|
||||
}
|
||||
if(!get_int_pref("ShowStartupSplash", true)) {
|
||||
sf::Time delay = time_in_ticks(60);
|
||||
sf::Clock timer;
|
||||
while(timer.getElapsedTime() < delay)
|
||||
while(timer.getElapsedTime() < delay) {
|
||||
handle_splash_events();
|
||||
fps_limiter.frame_finished();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,9 +154,11 @@ void plop_fancy_startup() {
|
||||
play_sound(-22);
|
||||
sf::Clock timer;
|
||||
|
||||
cFramerateLimiter fps_limiter;
|
||||
while(timer.getElapsedTime() < delay) {
|
||||
draw_splash(pict_to_draw, mainPtr, intro_from);
|
||||
handle_splash_events();
|
||||
fps_limiter.frame_finished();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,9 +26,7 @@ void erase_hidden_towns(cOutdoors& sector, int quadrant_x, int quadrant_y);
|
||||
void erase_completed_specials(cArea& sector, std::function<void(location)> clear_spot);
|
||||
void erase_out_specials();
|
||||
bool does_location_have_special(cOutdoors& sector, location loc, eTerSpec type);
|
||||
void clear_map();
|
||||
void draw_map(bool need_refresh);
|
||||
bool is_door(location destination);
|
||||
void display_map();
|
||||
|
||||
void check_done();
|
||||
bool quadrant_legal(short i, short j) ;
|
||||
|
@@ -9,16 +9,19 @@
|
||||
#include "boe.ui.hpp"
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#include "enum_map.hpp"
|
||||
#include "boe.consts.hpp"
|
||||
#include "boe.locutils.hpp"
|
||||
#include "boe.graphics.hpp"
|
||||
#include "framerate_limiter.hpp"
|
||||
#include "mathutil.hpp"
|
||||
#include "render_shapes.hpp"
|
||||
#include "render_image.hpp"
|
||||
#include "res_image.hpp"
|
||||
#include "mathutil.hpp"
|
||||
#include "sounds.hpp"
|
||||
|
||||
#include "boe.consts.hpp"
|
||||
#include "boe.locutils.hpp"
|
||||
#include "boe.graphics.hpp"
|
||||
|
||||
namespace UI {
|
||||
cToolbar toolbar;
|
||||
}
|
||||
@@ -60,6 +63,7 @@ eToolbarButton cToolbar::button_hit(sf::RenderWindow& win, location click) {
|
||||
bool done = false, clicked = false;
|
||||
win.setActive();
|
||||
active = i;
|
||||
cFramerateLimiter fps_limiter;
|
||||
while(!done){
|
||||
redraw_screen(REFRESH_NONE);
|
||||
while(win.pollEvent(e)) {
|
||||
@@ -79,6 +83,8 @@ eToolbarButton cToolbar::button_hit(sf::RenderWindow& win, location click) {
|
||||
active = toolbar[i].bounds.contains(toPos) ? i : -1;
|
||||
}
|
||||
}
|
||||
if (!done)
|
||||
fps_limiter.frame_finished();
|
||||
}
|
||||
play_sound(37, time_in_ticks(5));
|
||||
redraw_screen(REFRESH_NONE);
|
||||
|
Reference in New Issue
Block a user