| 34 | namespace anim_coll |
| 35 | { |
| 36 | void reset(xEnt& ent) |
| 37 | { |
| 38 | if (!ent.anim_coll) |
| 39 | { |
| 40 | ent.anim_coll = (xEnt::anim_coll_data*)xMemAllocSize(sizeof(xEnt::anim_coll_data)); |
| 41 | ent.anim_coll->flags = 0; |
| 42 | ent.anim_coll->verts = NULL; |
| 43 | } |
| 44 | |
| 45 | xModelInstance& model = *ent.model; |
| 46 | xMat4x3& mat = *(xMat4x3*)model.Mat; |
| 47 | xEnt::anim_coll_data& ac = *ent.anim_coll; |
| 48 | |
| 49 | if (!(ac.flags & 0x8)) |
| 50 | { |
| 51 | switch (model.BoneCount) |
| 52 | { |
| 53 | case 1: |
| 54 | { |
| 55 | ac.flags |= 0x1; |
| 56 | ac.old_mat = mat; |
| 57 | ac.new_mat = g_I3; |
| 58 | break; |
| 59 | } |
| 60 | case 0: |
| 61 | { |
| 62 | break; |
| 63 | } |
| 64 | default: |
| 65 | { |
| 66 | ac.flags |= 0x2; |
| 67 | ac.old_mat = mat; |
| 68 | ac.new_mat = g_I3; |
| 69 | |
| 70 | xModelAnimCollStart(model); |
| 71 | |
| 72 | xBox& box = ent.bound.box.box; |
| 73 | xVec3 size = box.upper - box.lower; |
| 74 | F32 max_size = size.x; |
| 75 | |
| 76 | if (max_size < size.y) |
| 77 | { |
| 78 | max_size = size.y; |
| 79 | } |
| 80 | |
| 81 | if (max_size < size.z) |
| 82 | { |
| 83 | max_size = size.z; |
| 84 | } |
| 85 | |
| 86 | max_size += 1.0f; |
| 87 | |
| 88 | box.upper += max_size; |
| 89 | box.lower -= max_size; |
| 90 | |
| 91 | model.Data->boundingSphere.radius *= 3.0f; |
| 92 | } |
| 93 | } |
no test coverage detected