mirror of
https://github.com/DrBeef/Quake2Quest.git
synced 2024-11-10 06:41:53 +00:00
Various fixes - Weapon positioning
This commit is contained in:
parent
a04f1ffed3
commit
3ffe6dd335
9 changed files with 79 additions and 40 deletions
|
@ -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="1"
|
||||
android:versionName="0.1.0" android:installLocation="auto" >
|
||||
android:versionCode="2"
|
||||
android:versionName="0.2.0" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
|
|
|
@ -335,7 +335,7 @@ void HandleInput_Right(ovrMobile * Ovr, double displayTime )
|
|||
|
||||
#ifndef NDEBUG
|
||||
Cbuf_AddText( "cheats 1\n" );
|
||||
Cbuf_AddText( "give weapons\n" );
|
||||
Cbuf_AddText( "give all\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -537,18 +537,30 @@ void CL_ParsePlayerstate (frame_t *oldframe, frame_t *newframe)
|
|||
if (flags & PS_M_TYPE)
|
||||
state->pmove.pm_type = MSG_ReadByte (&net_message);
|
||||
|
||||
if (flags & PS_M_ORIGIN)
|
||||
{
|
||||
state->pmove.origin[0] = MSG_ReadFloat (&net_message);
|
||||
state->pmove.origin[1] = MSG_ReadFloat (&net_message);
|
||||
state->pmove.origin[2] = MSG_ReadFloat (&net_message);
|
||||
}
|
||||
if (flags & PS_VRSERVER) {
|
||||
if (flags & PS_M_ORIGIN) {
|
||||
state->pmove.origin[0] = MSG_ReadFloat(&net_message);
|
||||
state->pmove.origin[1] = MSG_ReadFloat(&net_message);
|
||||
state->pmove.origin[2] = MSG_ReadFloat(&net_message);
|
||||
}
|
||||
|
||||
if (flags & PS_M_VELOCITY)
|
||||
{
|
||||
state->pmove.velocity[0] = MSG_ReadFloat (&net_message);
|
||||
state->pmove.velocity[1] = MSG_ReadFloat (&net_message);
|
||||
state->pmove.velocity[2] = MSG_ReadFloat (&net_message);
|
||||
if (flags & PS_M_VELOCITY) {
|
||||
state->pmove.velocity[0] = MSG_ReadFloat(&net_message);
|
||||
state->pmove.velocity[1] = MSG_ReadFloat(&net_message);
|
||||
state->pmove.velocity[2] = MSG_ReadFloat(&net_message);
|
||||
}
|
||||
} else {
|
||||
if (flags & PS_M_ORIGIN) {
|
||||
state->pmove.origin[0] = MSG_ReadShort(&net_message);
|
||||
state->pmove.origin[1] = MSG_ReadShort(&net_message);
|
||||
state->pmove.origin[2] = MSG_ReadShort(&net_message);
|
||||
}
|
||||
|
||||
if (flags & PS_M_VELOCITY) {
|
||||
state->pmove.velocity[0] = MSG_ReadShort(&net_message);
|
||||
state->pmove.velocity[1] = MSG_ReadShort(&net_message);
|
||||
state->pmove.velocity[2] = MSG_ReadShort(&net_message);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & PS_M_TIME)
|
||||
|
@ -557,15 +569,26 @@ void CL_ParsePlayerstate (frame_t *oldframe, frame_t *newframe)
|
|||
if (flags & PS_M_FLAGS)
|
||||
state->pmove.pm_flags = MSG_ReadByte (&net_message);
|
||||
|
||||
if (flags & PS_M_GRAVITY)
|
||||
state->pmove.gravity = MSG_ReadFloat (&net_message);
|
||||
if (flags & PS_VRSERVER) {
|
||||
if (flags & PS_M_GRAVITY)
|
||||
state->pmove.gravity = MSG_ReadFloat(&net_message);
|
||||
|
||||
if (flags & PS_M_DELTA_ANGLES) {
|
||||
state->pmove.delta_angles[0] = MSG_ReadFloat(&net_message);
|
||||
state->pmove.delta_angles[1] = MSG_ReadFloat(&net_message);
|
||||
state->pmove.delta_angles[2] = MSG_ReadFloat(&net_message);
|
||||
}
|
||||
} else {
|
||||
if (flags & PS_M_GRAVITY)
|
||||
state->pmove.gravity = MSG_ReadShort(&net_message);
|
||||
|
||||
if (flags & PS_M_DELTA_ANGLES) {
|
||||
state->pmove.delta_angles[0] = MSG_ReadShort(&net_message);
|
||||
state->pmove.delta_angles[1] = MSG_ReadShort(&net_message);
|
||||
state->pmove.delta_angles[2] = MSG_ReadShort(&net_message);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & PS_M_DELTA_ANGLES)
|
||||
{
|
||||
state->pmove.delta_angles[0] = MSG_ReadFloat (&net_message);
|
||||
state->pmove.delta_angles[1] = MSG_ReadFloat (&net_message);
|
||||
state->pmove.delta_angles[2] = MSG_ReadFloat (&net_message);
|
||||
}
|
||||
|
||||
if (cl.attractloop)
|
||||
state->pmove.pm_type = PM_FREEZE; // demo playback
|
||||
|
@ -598,10 +621,11 @@ void CL_ParsePlayerstate (frame_t *oldframe, frame_t *newframe)
|
|||
{
|
||||
state->gunindex = MSG_ReadByte (&net_message);
|
||||
|
||||
if (!isMultiplayer()) {
|
||||
//Only read this if not multiplayer
|
||||
if (flags & PS_VRSERVER) {
|
||||
state->weapmodel = MSG_ReadByte(&net_message);
|
||||
}
|
||||
} else {
|
||||
state->weapmodel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & PS_WEAPONFRAME)
|
||||
|
@ -1352,6 +1376,7 @@ extern cvar_t *vr_worldscale;
|
|||
extern vec3_t weaponangles;
|
||||
extern vec3_t weaponoffset;
|
||||
extern vec3_t hmdorientation;
|
||||
extern vec3_t hmdPosition;
|
||||
|
||||
void convertFromVRtoQ2(vec3_t in, vec3_t offset, vec3_t out);
|
||||
|
||||
|
@ -1401,9 +1426,14 @@ static void SetWeapon6DOF(int weapmodel, vec3_t origin, vec3_t gunorigin, vec3_t
|
|||
|
||||
VectorAdd(origin, gunoffset, gunorigin);
|
||||
VectorAdd(gunorigin, position_adjust, gunorigin);
|
||||
gunorigin[2] -= 12;
|
||||
VectorCopy(weaponangles, gunangles);
|
||||
gunangles[PITCH] -= 5; // HACK!! (gun angle not quite right)
|
||||
|
||||
//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);
|
||||
|
||||
|
||||
VectorCopy(weaponangles, gunangles);
|
||||
gunangles[PITCH] -= 3; // HACK!! (gun angle not quite right)
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -518,11 +518,8 @@ V_RenderView
|
|||
extern vec3_t hmdPosition;
|
||||
extern cvar_t *vr_worldscale;
|
||||
|
||||
#define QUAKE_MARINE_HEIGHT 1.57
|
||||
|
||||
void V_RenderView( float stereo_separation )
|
||||
{
|
||||
|
||||
extern int entitycmpfnc( const entity_t *, const entity_t * );
|
||||
|
||||
if (cls.state != ca_active)
|
||||
|
|
|
@ -620,7 +620,7 @@ void Con_DrawConsole (float frac, float separation)
|
|||
SCR_AddDirtyPoint (offset,0);
|
||||
SCR_AddDirtyPoint (offset+viddef.width-1,lines-1);
|
||||
|
||||
Com_sprintf (version, sizeof(version), "v%4.2f", VERSION);
|
||||
Com_sprintf (version, sizeof(version), "Quake2Quest v%4.2f", VERSION);
|
||||
for (x=0 ; x<5 ; x++)
|
||||
#ifdef QMAX
|
||||
re.DrawChar (offset+viddef.width-44+x*8, lines-12, 128+version[x],1);
|
||||
|
|
|
@ -1574,6 +1574,7 @@ vec3_t angles_b;
|
|||
|
||||
extern vec3_t weaponangles;
|
||||
extern vec3_t weaponoffset;
|
||||
extern vec3_t hmdPosition;
|
||||
|
||||
extern cvar_t *vr_worldscale;
|
||||
|
||||
|
@ -1600,9 +1601,17 @@ static void SV_SetWeapon_Client6DOF(edict_t *ent)
|
|||
vec3_t origin;
|
||||
vec3_t weaponoffsetQ2;
|
||||
vec3_t offset;
|
||||
VectorSet(offset, 0, 0, ent->viewheight-8);
|
||||
VectorSet(offset, 0, 0, 7-ent->viewheight);
|
||||
convertFromVRtoQ2(weaponoffset, offset, weaponoffsetQ2);
|
||||
VectorCopy(ent->s.origin, origin);
|
||||
|
||||
//add player actual real world height - controller location is relative to HMD
|
||||
if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
|
||||
{
|
||||
origin[2] -= 48; //??
|
||||
}
|
||||
|
||||
origin[2] += (hmdPosition[1] * vr_worldscale->value);
|
||||
VectorAdd(weaponoffsetQ2, origin, ent->s.origin);
|
||||
VectorCopy(weaponangles, ent->client->v_angle); // use adjusted angles
|
||||
}
|
||||
|
|
|
@ -1506,7 +1506,7 @@ void Qcommon_Init (int argc, char **argv)
|
|||
dedicated = Cvar_Get ("dedicated", "0", CVAR_NOSET);
|
||||
#endif
|
||||
|
||||
s = va("%4.2f %s %s %s", VERSION, CPUSTRING, __DATE__, BUILDSTRING);
|
||||
s = va("Quake2Quest %4.2f %s %s %s", VERSION, CPUSTRING, __DATE__, BUILDSTRING);
|
||||
Cvar_Get ("version", s, CVAR_SERVERINFO|CVAR_NOSET);
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../game/q_shared.h"
|
||||
|
||||
|
||||
#define VERSION 3.21
|
||||
//#define VERSION 3.21
|
||||
#define VERSION 0.2
|
||||
|
||||
#define BASEDIRNAME "baseq2"
|
||||
|
||||
|
@ -193,6 +194,8 @@ PROTOCOL
|
|||
|
||||
#define PROTOCOL_VERSION 34
|
||||
|
||||
#define QUAKE_MARINE_HEIGHT 1.57
|
||||
|
||||
//=========================================
|
||||
|
||||
#define PORT_MASTER 27900
|
||||
|
@ -278,6 +281,8 @@ enum clc_ops_e
|
|||
#define PS_WEAPONFRAME (1<<13)
|
||||
#define PS_RDFLAGS (1<<14)
|
||||
|
||||
#define PS_VRSERVER (1<<15)
|
||||
|
||||
//==============================================
|
||||
|
||||
// user_cmd_t communication
|
||||
|
|
|
@ -241,7 +241,7 @@ void SV_WritePlayerstateToClient (client_frame_t *from, client_frame_t *to, size
|
|||
//
|
||||
// determine what needs to be sent
|
||||
//
|
||||
pflags = 0;
|
||||
pflags = PS_VRSERVER; // we are a VR server!
|
||||
|
||||
if (ps->pmove.pm_type != ops->pmove.pm_type)
|
||||
pflags |= PS_M_TYPE;
|
||||
|
@ -373,10 +373,8 @@ void SV_WritePlayerstateToClient (client_frame_t *from, client_frame_t *to, size
|
|||
{
|
||||
MSG_WriteByte (msg, ps->gunindex);
|
||||
|
||||
if (!isMultiplayer()) {
|
||||
//Add if for multiplayer
|
||||
MSG_WriteByte(msg, ps->weapmodel);
|
||||
}
|
||||
//We are a VR server so write this out
|
||||
MSG_WriteByte(msg, ps->weapmodel);
|
||||
}
|
||||
|
||||
if (pflags & PS_WEAPONFRAME)
|
||||
|
|
Loading…
Reference in a new issue