mirror of
https://github.com/DrBeef/Quake2Quest.git
synced 2024-11-10 06:41:53 +00:00
Better weapon placement
This commit is contained in:
parent
0a952adc6a
commit
9747d8b02d
1 changed files with 26 additions and 7 deletions
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// cl_ents.c -- entity parsing and management
|
||||
|
||||
#include "client.h"
|
||||
#include "../../../Quake2VR/mathlib.h"
|
||||
|
||||
|
||||
extern struct model_s *cl_mod_powerscreen;
|
||||
|
@ -1344,16 +1345,34 @@ void CL_AddPacketEntities (frame_t *frame)
|
|||
extern cvar_t *vr_worldscale;
|
||||
extern vec3_t weaponangles;
|
||||
extern vec3_t weaponoffset;
|
||||
extern vec3_t hmdorientation;
|
||||
|
||||
void convertFromVRtoQ2(vec3_t in, vec3_t offset, vec3_t out);
|
||||
|
||||
void ProjectSource (vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
|
||||
{
|
||||
result[0] = point[0] + forward[0] * distance[0] + right[0] * distance[1];
|
||||
result[1] = point[1] + forward[1] * distance[0] + right[1] * distance[1];
|
||||
result[2] = point[2] + forward[2] * distance[0] + right[2] * distance[1] + distance[2];
|
||||
}
|
||||
|
||||
static void SetWeapon6DOF(vec3_t origin, vec3_t gunorigin, vec3_t gunangles)
|
||||
{
|
||||
vec3_t offset;
|
||||
vec3_t gunoffset;
|
||||
VectorSet(offset, 0, 0, 0);
|
||||
convertFromVRtoQ2(weaponoffset, offset, gunoffset);
|
||||
VectorAdd(origin, gunoffset, gunorigin);
|
||||
|
||||
vec3_t n0_offset;
|
||||
VectorSet(n0_offset, 0, 0, 0);
|
||||
convertFromVRtoQ2(weaponoffset, n0_offset, gunoffset);
|
||||
|
||||
vec3_t offset;
|
||||
VectorSet(offset, -10, -4, -6);
|
||||
vec3_t forward;
|
||||
vec3_t right;
|
||||
AngleVectors (weaponangles, forward, right, NULL);
|
||||
vec3_t new_gun_offset;
|
||||
ProjectSource (gunoffset, offset, forward, right, new_gun_offset);
|
||||
|
||||
VectorAdd(origin, new_gun_offset, gunorigin);
|
||||
VectorCopy(weaponangles, gunangles);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue