Fixed laser sights

Works alright now, also removed cheats from the config by default.
This commit is contained in:
Simon 2019-11-20 18:50:53 +00:00
parent 52d2881835
commit 963e5061bc
8 changed files with 53 additions and 32 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.quake2quest"
android:versionCode="5"
android:versionName="0.5.0" android:installLocation="auto" >
android:versionCode="6"
android:versionName="0.6.0" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -1395,7 +1395,7 @@ void convertFromVRtoQ2(vec3_t in, vec3_t offset, vec3_t out);
#define WEAP_RAILGUN 10
#define WEAP_BFG 11
static void SetWeapon6DOF(int weapmodel, vec3_t origin, vec3_t gunorigin, vec3_t gunangles)
void SetWeapon6DOF(int weapmodel, vec3_t origin, vec3_t gunorigin, vec3_t gunangles)
{
vec3_t gunoffset;
convertFromVRtoQ2(weaponoffset, NULL, gunoffset);
@ -1403,15 +1403,16 @@ static void SetWeapon6DOF(int weapmodel, vec3_t origin, vec3_t gunorigin, vec3_t
int lrOffset = (( r_lefthand->value == 1.0F ) ? -7 : 7) * vr_weaponscale->value;
//fb / lr / ud
vec3_t offset;
VectorSet(offset, 0, 0, 0);
if (weapmodel == WEAP_BLASTER ||
weapmodel == WEAP_MACHINEGUN)
VectorSet(offset, 17 * vr_weaponscale->value, lrOffset, -8 * vr_weaponscale->value);
else if (weapmodel == WEAP_SHOTGUN)
VectorSet(offset, 12 * vr_weaponscale->value, lrOffset * 1.12, -8 * vr_weaponscale->value);
VectorSet(offset, 12 * vr_weaponscale->value, lrOffset * 1.1, -8 * vr_weaponscale->value);
else if (weapmodel == WEAP_CHAINGUN)
VectorSet(offset, 3.5 * vr_weaponscale->value, lrOffset, -8 * vr_weaponscale->value);
else
VectorSet(offset, 10 * vr_weaponscale->value, lrOffset, -8 * vr_weaponscale->value);
VectorSet(offset, 3.5 * vr_weaponscale->value, lrOffset * 0.85, -8 * vr_weaponscale->value);
else if (weapmodel != 0)
VectorSet(offset, 10 * vr_weaponscale->value, lrOffset, -8 * vr_weaponscale->value);
vec3_t tempAngles;
VectorCopy(weaponangles, tempAngles);
@ -1433,15 +1434,12 @@ static void SetWeapon6DOF(int weapmodel, vec3_t origin, vec3_t gunorigin, vec3_t
VectorAdd(origin, gunoffset, gunorigin);
VectorAdd(gunorigin, position_adjust, gunorigin);
//add player actual real world height - controller location is relative to HMD
gunorigin[2] -= (QUAKE_MARINE_HEIGHT * vr_worldscale->value);
gunorigin[2] += (hmdPosition[1] * vr_worldscale->value);
matrix4x4 matAngleAdjust;
vec3_t angleAdjust;
VectorSet(angleAdjust, 0, 0, 0);
if (weapmodel == WEAP_MACHINEGUN)
VectorSet(angleAdjust, -3, 6, -4); // Fix crap model orientation!!
else
else if (weapmodel != 0)
VectorSet(angleAdjust, -3, 0, 0);
Matrix4x4_CreateFromEntity(matAngleAdjust, angleAdjust, vec3_origin, 1.0);
@ -1481,6 +1479,10 @@ void CL_AddViewWeapon (player_state_t *ps, player_state_t *ops)
// set up gun position
SetWeapon6DOF(ps->weapmodel, cl.refdef.vieworg, gun.origin, gun.angles);
//add player actual real world height - controller location is relative to HMD
gun.origin[2] -= (QUAKE_MARINE_HEIGHT * vr_worldscale->value);
gun.origin[2] += (hmdPosition[1] * vr_worldscale->value);
if (gun_frame)
{
gun.frame = gun_frame; // development tool

View file

@ -1766,6 +1766,9 @@ void CL_BeginFrame (int msec) {
// predict all unacknowledged movements
CL_PredictMovement();
//HACK!
CL_UpdateLaserSightOrigins();
// allow rendering DLL change
VID_CheckChanges();
if (!cl.refresh_prepped && cls.state == ca_active)

View file

@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_tent.c -- client side temporary entities
#include <src/game/q_shared.h>
#include "client.h"
typedef enum
@ -589,18 +590,40 @@ CL_ParseLaserSight
*/
void CL_ParseLaserSight ()
{
vec3_t start;
vec3_t end;
laser_t *l = &cl_lasersight;
int i;
//Set end time so laser is drawn
cl_lasersight.ent.flags = RF_LASERSIGHT;
cl_lasersight.endtime = cl.time+250;
}
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
void SetWeapon6DOF(int weapmodel, vec3_t origin, vec3_t gunorigin, vec3_t gunangles);
l->ent.flags = RF_LASERSIGHT;
VectorCopy (start, l->ent.origin);
VectorCopy (end, l->ent.oldorigin);
l->endtime = cl.time+250;
trace_t CL_Trace (vec3_t start, vec3_t end, float size, int contentmask)
{
vec3_t maxs, mins;
VectorSet(maxs, size, size, size);
VectorSet(mins, -size, -size, -size);
return CM_BoxTrace (start, end, mins, maxs, 0, contentmask);
}
void CL_UpdateLaserSightOrigins ()
{
if (cl_lasersight.endtime > cl.time) {
vec3_t forward, right;
vec3_t end;
vec3_t gunorigin;
vec3_t gunangles;
//At the point of calling this, the vieworg should already have the player height included
SetWeapon6DOF(0, cl.refdef.vieworg, gunorigin, gunangles);
gunorigin[2] += 1; // just add a little bit
AngleVectors(gunangles, forward, right, NULL);
VectorMA(gunorigin, 8192, forward, end);
trace_t tr = CL_Trace(gunorigin, end, 1,
CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER);
VectorCopy(gunorigin, cl_lasersight.ent.origin);
VectorCopy(tr.endpos, cl_lasersight.ent.oldorigin);
}
}
#ifdef QMAX

View file

@ -391,6 +391,7 @@ void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count);
// RAFAEL
void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count);
void CL_UpdateLaserSightOrigins ();
//=================================================

View file

@ -457,16 +457,8 @@ void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST,
//Laser sight?
if (vr_lasersight->value == 1.0f)
{
vec3_t forward, right;
vec3_t end;
AngleVectors (ent->client->v_angle, forward, right, NULL);
VectorMA (ent->s.origin, 8192, forward, end);
trace_t tr = gi.trace (ent->s.origin, NULL, NULL, end, ent, CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_DEADMONSTER);
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_LASER_SIGHT);
gi.WritePosition (ent->s.origin);
gi.WritePosition (tr.endpos);
gi.multicast (ent->s.origin, MULTICAST_PHS);
}

View file

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#define VERSION 3.21
#define VERSION 0.5
#define VERSION 0.6
#define BASEDIRNAME "baseq2"

View file

@ -1,4 +1,4 @@
set cheats "1"
// set cheats "1"
/////////////////////// key bindings
bind AUX3 "weapnext"