record and replay screen shifting while looking

This commit is contained in:
2024-08-26 19:46:39 -05:00
committed by Celtic Minstrel
parent 6c50cf000d
commit 6165a3f823
2 changed files with 24 additions and 0 deletions

View File

@@ -1155,6 +1155,19 @@ static void handle_party_death() {
}
void screen_shift(int dx, int dy, bool& need_redraw) {
if(recording){
std::map<std::string,std::string> info;
std::ostringstream sstr;
sstr << dx;
info["dx"] = sstr.str();
sstr.str("");
sstr << dy;
info["dy"] = sstr.str();
record_action("screen_shift", info);
}
center.x += dx;
center.y += dy;

View File

@@ -412,6 +412,17 @@ static void replay_next_action() {
eKeyMod mods = static_cast<eKeyMod>(std::stoi(info["mods"]));
handle_look(destination, right_button, mods, need_redraw, need_reprint);
}else if(t == "screen_shift"){
auto info = info_from_action(next_action);
std::istringstream sstr(info["dx"]);
int dx = 0;
sstr >> dx;
sstr.str(info["dy"]);
int dy = 0;
sstr >> dy;
screen_shift(dx, dy, need_redraw);
}
// TODO some of these actions shouldn't call advance_time(). They should return