1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

ads:: reverse replay feature

This commit is contained in:
Zeno Rogue 2023-02-03 15:28:37 +01:00
parent bc3b4841b7
commit 9c04b39ed3
3 changed files with 9 additions and 1 deletions

View File

@ -126,6 +126,7 @@ void run_ads_game_std();
void run_ds_game();
/** in the replay mode */
bool rev_replay;
bool in_replay;
void switch_replay();
void switch_pause();

View File

@ -86,6 +86,8 @@ void edit_view_mode() {
dialog::addBoolItem(XLAT("view replay"), in_replay, 'r');
dialog::add_action(switch_replay);
dialog::addBoolItem_action(XLAT("reverse replay"), rev_replay, 'w');
dialog::addBreak(100);
if(!main_rock) add_edit(auto_rotate);

View File

@ -119,7 +119,12 @@ void replay_animation() {
nomap = main_rock ? (!hyperbolic || among(pmodel, mdRelPerspective, mdRelOrthogonal)) : !sl2;
if(in_replay) {
view_pt = (ticks / 1000.) * DS_(simspeed);
static int oticks = ticks;
if(inHighQual)
view_pt = (ticks / 1000.) * DS_(simspeed) * (rev_replay ? -1 : 1);
else
view_pt += ((ticks - oticks) / 1000.) * DS_(simspeed) * (rev_replay ? -1 : 1);
oticks = ticks;
ld maxt = history.back().start + 0.001;
view_pt -= maxt * floor(view_pt / maxt);
for(auto& ss: history)