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)
|
if(overall_mode != MODE_TALKING)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(overall_mode == MODE_SHOPPING) {
|
else if(overall_mode == MODE_SHOPPING) {
|
||||||
handle_shop_event(the_point);
|
handle_shop_event(the_point);
|
||||||
if(overall_mode != MODE_SHOPPING)
|
if(overall_mode != MODE_SHOPPING)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise they're in a terrain view mode
|
// Otherwise they're in a terrain view mode
|
||||||
|
else {
|
||||||
location cur_loc = is_out() ? univ.party.out_loc : center;
|
location cur_loc = is_out() ? univ.party.out_loc : center;
|
||||||
auto button_hit = UI::toolbar.button_hit(mainPtr, the_point);
|
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: End: Screen shift
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: Process clicks in PC stats area
|
// MARK: Process clicks in PC stats area
|
||||||
if(the_point.in(win_to_rects[WINRECT_PCSTATS])) {
|
if(the_point.in(win_to_rects[WINRECT_PCSTATS])) {
|
||||||
|
@@ -174,10 +174,6 @@ void end_shop_mode() {
|
|||||||
shop_sbar->hide();
|
shop_sbar->hide();
|
||||||
done_btn->hide();
|
done_btn->hide();
|
||||||
help_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;
|
overall_mode = store_pre_shop_mode;
|
||||||
if(overall_mode == MODE_TALK_TOWN)
|
if(overall_mode == MODE_TALK_TOWN)
|
||||||
@@ -186,6 +182,14 @@ void end_shop_mode() {
|
|||||||
center = univ.party.town_loc;
|
center = univ.party.town_loc;
|
||||||
update_explored(center);
|
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;
|
stat_screen_mode = MODE_INVEN;
|
||||||
put_item_screen(stat_window);
|
put_item_screen(stat_window);
|
||||||
put_pc_screen();
|
put_pc_screen();
|
||||||
|
@@ -607,10 +607,16 @@ void alter_space(short i,short j,ter_num_t ter) {
|
|||||||
location l(i,j);
|
location l(i,j);
|
||||||
l = local_to_global(l);
|
l = local_to_global(l);
|
||||||
univ.out[l.x][l.y] = ter;
|
univ.out[l.x][l.y] = ter;
|
||||||
|
if (univ.out->terrain[i][j] != ter) {
|
||||||
univ.out->terrain[i][j] = ter;
|
univ.out->terrain[i][j] = ter;
|
||||||
|
minimap::draw(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ter_num_t former = univ.town->terrain(i,j);
|
ter_num_t former = univ.town->terrain(i,j);
|
||||||
|
if (former!=ter) {
|
||||||
univ.town->terrain(i,j) = ter;
|
univ.town->terrain(i,j) = ter;
|
||||||
|
minimap::draw(true);
|
||||||
|
}
|
||||||
if(univ.scenario.ter_types[ter].special == eTerSpec::CONVEYOR)
|
if(univ.scenario.ter_types[ter].special == eTerSpec::CONVEYOR)
|
||||||
univ.town.belt_present = true;
|
univ.town.belt_present = true;
|
||||||
if(univ.scenario.ter_types[former].light_radius != univ.scenario.ter_types[ter].light_radius)
|
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);
|
windows.setVisible(true);
|
||||||
visible = true;
|
visible = true;
|
||||||
draw(true);
|
draw(true);
|
||||||
|
// when a game is loaded, the windows is not adapted correctly
|
||||||
|
// try to force a new refresh
|
||||||
|
changed = true;
|
||||||
makeFrontWindow(mainPtr);
|
makeFrontWindow(mainPtr);
|
||||||
|
|
||||||
set_cursor(sword_curs);
|
set_cursor(sword_curs);
|
||||||
@@ -354,6 +357,9 @@ bool pollEvent()
|
|||||||
makeFrontWindow(mainPtr);
|
makeFrontWindow(mainPtr);
|
||||||
else if(event.type == sf::Event::KeyPressed) {
|
else if(event.type == sf::Event::KeyPressed) {
|
||||||
switch(event.key.code) {
|
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:
|
case sf::Keyboard::Escape:
|
||||||
set_visible(false);
|
set_visible(false);
|
||||||
break;
|
break;
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#include "strdlog.hpp"
|
#include "strdlog.hpp"
|
||||||
#include "choicedlog.hpp"
|
#include "choicedlog.hpp"
|
||||||
#include "fileio.hpp"
|
#include "fileio.hpp"
|
||||||
|
#include "framerate_limiter.hpp"
|
||||||
#include "spell.hpp"
|
#include "spell.hpp"
|
||||||
#include "sounds.hpp"
|
#include "sounds.hpp"
|
||||||
#include "universe.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);
|
add_string_to_buf(debug);
|
||||||
redraw_screen(REFRESH_TRANS);
|
redraw_screen(REFRESH_TRANS);
|
||||||
sf::Event evt;
|
sf::Event evt;
|
||||||
|
cFramerateLimiter fps_limiter;
|
||||||
while(true) {
|
while(true) {
|
||||||
if(mainPtr.pollEvent(evt) && (evt.type == sf::Event::KeyPressed || evt.type == sf::Event::MouseButtonPressed))
|
if(mainPtr.pollEvent(evt) && (evt.type == sf::Event::KeyPressed || evt.type == sf::Event::MouseButtonPressed))
|
||||||
break;
|
break;
|
||||||
|
fps_limiter.frame_finished();
|
||||||
}
|
}
|
||||||
if(evt.type == sf::Event::KeyPressed && evt.key.code == sf::Keyboard::Escape)
|
if(evt.type == sf::Event::KeyPressed && evt.key.code == sf::Keyboard::Escape)
|
||||||
univ.node_step_through = false;
|
univ.node_step_through = false;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include "boe.global.hpp"
|
#include "boe.global.hpp"
|
||||||
|
|
||||||
|
#include "framerate_limiter.hpp"
|
||||||
#include "universe.hpp"
|
#include "universe.hpp"
|
||||||
#include "boe.newgraph.hpp"
|
#include "boe.newgraph.hpp"
|
||||||
#include "boe.graphics.hpp"
|
#include "boe.graphics.hpp"
|
||||||
@@ -124,15 +125,19 @@ void show_logo() {
|
|||||||
auto const &pict_to_draw = *ResMgr::textures.get("spidlogo", true);
|
auto const &pict_to_draw = *ResMgr::textures.get("spidlogo", true);
|
||||||
|
|
||||||
play_sound(-95);
|
play_sound(-95);
|
||||||
|
cFramerateLimiter fps_limiter;
|
||||||
while(sound_going(95)) {
|
while(sound_going(95)) {
|
||||||
draw_splash(pict_to_draw, mainPtr, logo_from);
|
draw_splash(pict_to_draw, mainPtr, logo_from);
|
||||||
handle_splash_events();
|
handle_splash_events();
|
||||||
|
fps_limiter.frame_finished();
|
||||||
}
|
}
|
||||||
if(!get_int_pref("ShowStartupSplash", true)) {
|
if(!get_int_pref("ShowStartupSplash", true)) {
|
||||||
sf::Time delay = time_in_ticks(60);
|
sf::Time delay = time_in_ticks(60);
|
||||||
sf::Clock timer;
|
sf::Clock timer;
|
||||||
while(timer.getElapsedTime() < delay)
|
while(timer.getElapsedTime() < delay) {
|
||||||
handle_splash_events();
|
handle_splash_events();
|
||||||
|
fps_limiter.frame_finished();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,9 +154,11 @@ void plop_fancy_startup() {
|
|||||||
play_sound(-22);
|
play_sound(-22);
|
||||||
sf::Clock timer;
|
sf::Clock timer;
|
||||||
|
|
||||||
|
cFramerateLimiter fps_limiter;
|
||||||
while(timer.getElapsedTime() < delay) {
|
while(timer.getElapsedTime() < delay) {
|
||||||
draw_splash(pict_to_draw, mainPtr, intro_from);
|
draw_splash(pict_to_draw, mainPtr, intro_from);
|
||||||
handle_splash_events();
|
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_completed_specials(cArea& sector, std::function<void(location)> clear_spot);
|
||||||
void erase_out_specials();
|
void erase_out_specials();
|
||||||
bool does_location_have_special(cOutdoors& sector, location loc, eTerSpec type);
|
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);
|
bool is_door(location destination);
|
||||||
void display_map();
|
|
||||||
void check_done();
|
void check_done();
|
||||||
bool quadrant_legal(short i, short j) ;
|
bool quadrant_legal(short i, short j) ;
|
||||||
|
@@ -9,16 +9,19 @@
|
|||||||
#include "boe.ui.hpp"
|
#include "boe.ui.hpp"
|
||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
#include "enum_map.hpp"
|
#include "enum_map.hpp"
|
||||||
#include "boe.consts.hpp"
|
#include "framerate_limiter.hpp"
|
||||||
#include "boe.locutils.hpp"
|
#include "mathutil.hpp"
|
||||||
#include "boe.graphics.hpp"
|
|
||||||
#include "render_shapes.hpp"
|
#include "render_shapes.hpp"
|
||||||
#include "render_image.hpp"
|
#include "render_image.hpp"
|
||||||
#include "res_image.hpp"
|
#include "res_image.hpp"
|
||||||
#include "mathutil.hpp"
|
|
||||||
#include "sounds.hpp"
|
#include "sounds.hpp"
|
||||||
|
|
||||||
|
#include "boe.consts.hpp"
|
||||||
|
#include "boe.locutils.hpp"
|
||||||
|
#include "boe.graphics.hpp"
|
||||||
|
|
||||||
namespace UI {
|
namespace UI {
|
||||||
cToolbar toolbar;
|
cToolbar toolbar;
|
||||||
}
|
}
|
||||||
@@ -60,6 +63,7 @@ eToolbarButton cToolbar::button_hit(sf::RenderWindow& win, location click) {
|
|||||||
bool done = false, clicked = false;
|
bool done = false, clicked = false;
|
||||||
win.setActive();
|
win.setActive();
|
||||||
active = i;
|
active = i;
|
||||||
|
cFramerateLimiter fps_limiter;
|
||||||
while(!done){
|
while(!done){
|
||||||
redraw_screen(REFRESH_NONE);
|
redraw_screen(REFRESH_NONE);
|
||||||
while(win.pollEvent(e)) {
|
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;
|
active = toolbar[i].bounds.contains(toPos) ? i : -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!done)
|
||||||
|
fps_limiter.frame_finished();
|
||||||
}
|
}
|
||||||
play_sound(37, time_in_ticks(5));
|
play_sound(37, time_in_ticks(5));
|
||||||
redraw_screen(REFRESH_NONE);
|
redraw_screen(REFRESH_NONE);
|
||||||
|
Reference in New Issue
Block a user