- angles[0] = -e->v.angles[0];
- angles[1] = e->v.angles[1];
- angles[2] = e->v.angles[2];
- AngleVectors (angles, vf, vr, vu);
- VectorMA (e->v.origin, ent->v.view_ofs[0], vf, ent->v.origin);
- VectorMA (ent->v.origin, ent->v.view_ofs[1], vr, ent->v.origin);
- VectorMA (ent->v.origin, ent->v.view_ofs[2], vu, ent->v.origin);
+ if (e->v.angles[0] == ent->v.punchangle[0] && e->v.angles[1] == ent->v.punchangle[1] && e->v.angles[2] == ent->v.punchangle[2])
+ {
+ // quick case for no rotation
+ VectorAdd(e->v.origin, ent->v.view_ofs, ent->v.origin);
+ }
+ else
+ {
+ angles[0] = -ent->v.punchangle[0];
+ angles[1] = ent->v.punchangle[1];
+ angles[2] = ent->v.punchangle[2];
+ AngleVectors (angles, vf, vr, vu);
+ v[0] = ent->v.view_ofs[0] * vf[0] + ent->v.view_ofs[1] * vr[0] + ent->v.view_ofs[2] * vu[0];
+ v[1] = ent->v.view_ofs[0] * vf[1] + ent->v.view_ofs[1] * vr[1] + ent->v.view_ofs[2] * vu[1];
+ v[2] = ent->v.view_ofs[0] * vf[2] + ent->v.view_ofs[1] * vr[2] + ent->v.view_ofs[2] * vu[2];
+ angles[0] = -e->v.angles[0];
+ angles[1] = e->v.angles[1];
+ angles[2] = e->v.angles[2];
+ AngleVectors (angles, vf, vr, vu);
+ ent->v.origin[0] = v[0] * vf[0] + v[1] * vf[1] + v[2] * vf[2] + e->v.origin[0];
+ ent->v.origin[1] = v[0] * vr[0] + v[1] * vr[1] + v[2] * vr[2] + e->v.origin[1];
+ ent->v.origin[2] = v[0] * vu[0] + v[1] * vu[1] + v[2] * vu[2] + e->v.origin[2];
+ /*
+ ent->v.origin[0] = ent->v.view_ofs[0] * vf[0] + ent->v.view_ofs[0] * vf[1] + ent->v.view_ofs[0] * vf[2] + e->v.origin[0];
+ ent->v.origin[1] = ent->v.view_ofs[1] * vr[0] + ent->v.view_ofs[1] * vr[1] + ent->v.view_ofs[1] * vr[2] + e->v.origin[1];
+ ent->v.origin[2] = ent->v.view_ofs[2] * vu[0] + ent->v.view_ofs[2] * vu[1] + ent->v.view_ofs[2] * vu[2] + e->v.origin[2];
+ */
+ }