1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 17:40:36 +00:00

smoothcam:: export functions for append, save and load animation

This commit is contained in:
Zeno Rogue 2023-05-15 02:05:43 +02:00
parent 58a1b085c7
commit 97c24d7dfe

View File

@ -87,6 +87,18 @@ map<cell*, vector<vector<hyperpoint> > > traces;
vector<animation> anims;
vector<animation> 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) {