| 49 | } |
| 50 | |
| 51 | void AnimationClient::ApplyAnimationFlags(AnimationReader &reader, AnimationAssetRef &new_ref, char _flags) { |
| 52 | flags = _flags; |
| 53 | bool swap = (flags & _ANM_SWAP) != 0; |
| 54 | bool mobile = (flags & _ANM_MOBILE) != 0; |
| 55 | bool super_mobile = (flags & _ANM_SUPER_MOBILE) != 0; |
| 56 | bool mirrored = (flags & _ANM_MIRRORED) != 0; |
| 57 | float last_rotation; |
| 58 | float old_time; |
| 59 | if (swap) { |
| 60 | old_time = reader.GetAbsoluteTime(); |
| 61 | mobile = reader.GetMobile(); |
| 62 | super_mobile = reader.GetSuperMobile(); |
| 63 | mirrored = reader.GetMirrored(); |
| 64 | last_rotation = reader.GetLastRotation(); |
| 65 | } |
| 66 | reader.AttachTo(new_ref); |
| 67 | if (swap) { |
| 68 | reader.SetAbsoluteTime(old_time); |
| 69 | reader.SetLastRotation(last_rotation); |
| 70 | } else { |
| 71 | reader.SetSpeedMult(1.0f); |
| 72 | } |
| 73 | reader.SetMobile(mobile); |
| 74 | reader.SetSuperMobile(super_mobile); |
| 75 | |
| 76 | std::vector<mat4> initial_mats(skeleton->physics_bones.size()); |
| 77 | for (unsigned i = 0; i < skeleton->physics_bones.size(); ++i) { |
| 78 | initial_mats[i] = skeleton->physics_bones[i].initial_rotation; |
| 79 | } |
| 80 | |
| 81 | if (mirrored) { |
| 82 | reader.SetMirrored(true); |
| 83 | } else { |
| 84 | reader.SetMirrored(false); |
| 85 | } |
| 86 | |
| 87 | reader.ClearBlendAnim(); |
| 88 | } |
| 89 | |
| 90 | void AnimationClient::SetAnimation(const std::string &path, |
| 91 | float fade_speed, |
nothing calls this directly
no test coverage detected