diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 19:40:11 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 20:34:02 +0100 |
commit | 3d7ae4c401d5bd6109a7fd25eb22e5bc77f0a4aa (patch) | |
tree | 7c673746944b85fbafae891ac69594326b15b517 /src/scenery.cpp | |
parent | 6d0a594e618f165eb2823bb31eb3cfe21ec1e7c5 (diff) |
src: rework scenery updates
Diffstat (limited to 'src/scenery.cpp')
-rw-r--r-- | src/scenery.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/scenery.cpp b/src/scenery.cpp index fca45411..6b338635 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -67,7 +67,7 @@ scenery::scenery(door_tag_t, const anim_atlas& atlas, rotation r, bool is_open, void scenery_ref::rotate(rotation new_r) { - c->with_scenery_bbox_update(idx, [&]() { + c->with_scenery_update(idx, [&]() { auto& s = frame; s.bbox_offset = rotate_point(s.bbox_offset, s.r, new_r); s.bbox_size = rotate_size(s.bbox_size, s.r, new_r); @@ -143,6 +143,24 @@ bool scenery_ref::activate() return false; } +bool scenery::is_mesh_modified(const scenery& s0, const scenery& s) +{ + if (s.interactive != s0.interactive || s.type != s0.type) + return true; + if (!s.interactive) + return s.r != s0.r || s.offset != s0.offset || s0.frame != s.frame || s.type != s0.type; + return false; +} + +bool scenery::is_collision_modified(const scenery& s0, const scenery& s) +{ + // passability value is stored as object's id + // so don't optimize into (s.pass == pass) != (s0.pass == pass) + return s.r != s0.r || s.passability != s0.passability || + s.offset != s0.offset || + s.bbox_offset != s0.bbox_offset || s.bbox_size != s0.bbox_size; +} + #ifdef __GNUG__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" |