diff --git a/rogueviz/smoothcam.cpp b/rogueviz/smoothcam.cpp index 96ba38dd..f1703d96 100644 --- a/rogueviz/smoothcam.cpp +++ b/rogueviz/smoothcam.cpp @@ -87,6 +87,18 @@ map > > traces; vector anims; +vector anims_backup; + +void backup() { + anims_backup = anims; + } + +void append_backup() { + swap(anims_backup, anims); + for(auto a: anims_backup) anims.push_back(a); + anims_backup.clear(); + } + transmatrix last_view, current_position, last_view_comp; cell *last_centerover; @@ -697,6 +709,17 @@ auto hooks = arg::add3("-smoothcam", enable_and_show) } }); +void save_animation(hstream& f) { + if(f.vernum >= 0xA930) hwrite(f, smoothcam_params); + hwrite(f, anims); + } + +void load_animation(hstream& f) { + if(f.vernum >= 0xA930) hread(f, smoothcam_params); + hread(f, anims); + current_segment = &anims.back(); + } + auto hooksw = addHook(hooks_swapdim, 100, [] { last_segment = -1; for(auto& anim: anims) {