replay movement actions

This commit is contained in:
2024-07-03 16:48:14 -06:00
committed by Celtic Minstrel
parent 53d4bc2898
commit d23d5c5857
3 changed files with 15 additions and 5 deletions

View File

@@ -119,8 +119,6 @@ enum_map(eShopArea, rectangle) shopping_rects[8];
std::queue<pending_special_type> special_queue; std::queue<pending_special_type> special_queue;
bool end_scenario = false; bool end_scenario = false;
static void advance_time(bool did_something, bool need_redraw, bool need_reprint);
// This is defined in pc.editors.cpp since the PC editor also uses it // This is defined in pc.editors.cpp since the PC editor also uses it
extern void edit_stuff_done(); extern void edit_stuff_done();
@@ -501,7 +499,7 @@ static void handle_look(location destination, bool& need_redraw, bool& need_repr
} }
} }
static void handle_move(location destination, bool& did_something, bool& need_redraw, bool& need_reprint) { void handle_move(location destination, bool& did_something, bool& need_redraw, bool& need_reprint) {
if(recording) { if(recording) {
// record the action // record the action
std::stringstream out; std::stringstream out;
@@ -1421,7 +1419,7 @@ bool handle_action(const sf::Event& event) {
return are_done; return are_done;
} }
static void advance_time(bool did_something, bool need_redraw, bool need_reprint) { void advance_time(bool did_something, bool need_redraw, bool need_reprint) {
// MARK: At this point, see if any specials have been queued up, and deal with them // MARK: At this point, see if any specials have been queued up, and deal with them
// Note: We just check once here instead of looping because run_special also pulls from the queue. // Note: We just check once here instead of looping because run_special also pulls from the queue.
if(!special_queue.empty()) { if(!special_queue.empty()) {

View File

@@ -8,6 +8,8 @@
void init_screen_locs(); void init_screen_locs();
bool prime_time(); bool prime_time();
bool handle_action(const sf::Event& event); bool handle_action(const sf::Event& event);
void advance_time(bool did_something, bool need_redraw, bool need_reprint);
void handle_move(location destination, bool& did_something, bool& need_redraw, bool& need_reprint);
void handle_monster_actions(bool& need_redraw, bool& need_reprint); void handle_monster_actions(bool& need_redraw, bool& need_reprint);
bool someone_awake(); bool someone_awake();
void handle_menu_spell(short spell_picked,short spell_type) ; void handle_menu_spell(short spell_picked,short spell_type) ;

View File

@@ -19,6 +19,7 @@
#include "boe.party.hpp" #include "boe.party.hpp"
#include "boe.items.hpp" #include "boe.items.hpp"
#include "boe.locutils.hpp" #include "boe.locutils.hpp"
#include "boe.actions.hpp"
#include "boe.town.hpp" #include "boe.town.hpp"
#include "boe.dlgutil.hpp" #include "boe.dlgutil.hpp"
#include "boe.infodlg.hpp" #include "boe.infodlg.hpp"
@@ -252,13 +253,22 @@ void process_args(int argc, char* argv[]) {
} }
void replay_next_action() { void replay_next_action() {
bool did_something = false, need_redraw = false, need_reprint = false;
auto next_action = pop_next_action(); auto next_action = pop_next_action();
std::string t = next_action->Value(); std::string t = next_action->Value();
if(t == "load_party") { if(t == "load_party") {
decode_file(next_action->GetText(), tempDir / "temp.exg"); decode_file(next_action->GetText(), tempDir / "temp.exg");
load_party(tempDir / "temp.exg", univ); load_party(tempDir / "temp.exg", univ);
finish_load_party(); finish_load_party();
} else if(t == "move") {
location l;
std::stringstream sstr(next_action->GetText());
sstr >> l;
handle_move(l, did_something, need_redraw, need_reprint);
} }
advance_time(did_something, need_redraw, need_reprint);
} }
void init_boe(int argc, char* argv[]) { void init_boe(int argc, char* argv[]) {