mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 14:52:00 +00:00
Merge branch 'master' of https://github.com/DrBeef/ioq3quest
This commit is contained in:
commit
ebcec93abc
9 changed files with 106 additions and 75 deletions
|
@ -2,8 +2,8 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.ioq3quest"
|
||||
android:installLocation="preferExternal"
|
||||
android:versionCode="16"
|
||||
android:versionName="0.11.0">
|
||||
android:versionCode="17"
|
||||
android:versionName="0.12.0">
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
|
||||
<uses-feature android:glEsVersion="0x00030001" />
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
|||
android:hasCode="true">
|
||||
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
|
||||
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
|
||||
<meta-data android:name="com.oculus.ossplash" android:value="true"/>
|
||||
<activity android:name="com.drbeef.ioq3quest.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="landscape"
|
||||
|
|
BIN
android/app/src/main/assets/vr_splash.png
Normal file
BIN
android/app/src/main/assets/vr_splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7 KiB |
|
@ -2,10 +2,10 @@
|
|||
|
||||
setlocal
|
||||
|
||||
set BUILD_TYPE=debug
|
||||
set BUILD_TYPE=release
|
||||
set KEYSTORE=
|
||||
set KEYSTORE_PASS=
|
||||
set VERSION=0.6.0
|
||||
set VERSION=0.12.0
|
||||
|
||||
set ANDROID_SDK_ROOT=%AppData%\..\Local\Android\Sdk
|
||||
set adb="%ANDROID_SDK_ROOT%\platform-tools\adb.exe"
|
||||
|
@ -16,6 +16,7 @@ set JAVA_HOME=C:\Program Files\Android\Android Studio\jre\jre
|
|||
if "%1"=="clean" (
|
||||
rm -rf .\build
|
||||
rm -rf .\android\build
|
||||
rm -rf .\android\app\src\main\jniLibs\arm64-v8a
|
||||
)
|
||||
|
||||
if %BUILD_TYPE%==release (
|
||||
|
@ -60,6 +61,10 @@ if %BUILD_TYPE%==debug (
|
|||
copy .\app\build\outputs\apk\%BUILD_TYPE%\app-%BUILD_TYPE%.apk %APK_LOCATION%
|
||||
)
|
||||
|
||||
if "%1"=="nodeploy" (
|
||||
goto :END
|
||||
)
|
||||
|
||||
%adb% install -r %APK_LOCATION%
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
%adb% uninstall %PACKAGE_NAME%
|
||||
|
@ -72,28 +77,30 @@ if %ERRORLEVEL% NEQ 0 (
|
|||
)
|
||||
)
|
||||
|
||||
%adb% shell mkdir -p %ANDROID_STORAGE_LOCATION%
|
||||
%adb% push --sync "D:\Program Files (x86)\Steam\steamapps\common\Quake 3 Arena\baseq3" %ANDROID_STORAGE_LOCATION%
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
popd
|
||||
popd
|
||||
echo "Failed to transfer files."
|
||||
exit /b 1
|
||||
)
|
||||
%adb% push --sync ..\code\renderergl2\glsl %ANDROID_STORAGE_LOCATION%/baseq3/
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
popd
|
||||
popd
|
||||
echo "Failed to transfer shaders."
|
||||
exit /b 1
|
||||
)
|
||||
%adb% push --sync autoexec.cfg %ANDROID_STORAGE_LOCATION%/baseq3/
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
popd
|
||||
popd
|
||||
echo "Failed to transfer autoexec."
|
||||
exit /b 1
|
||||
)
|
||||
@REM %adb% shell mkdir -p %ANDROID_STORAGE_LOCATION%
|
||||
@REM %adb% push --sync "D:\Program Files (x86)\Steam\steamapps\common\Quake 3 Arena\baseq3" %ANDROID_STORAGE_LOCATION%
|
||||
@REM if %ERRORLEVEL% NEQ 0 (
|
||||
@REM popd
|
||||
@REM popd
|
||||
@REM echo "Failed to transfer files."
|
||||
@REM exit /b 1
|
||||
@REM )
|
||||
|
||||
@REM %adb% push --sync ..\code\renderergl2\glsl %ANDROID_STORAGE_LOCATION%/baseq3/
|
||||
@REM if %ERRORLEVEL% NEQ 0 (
|
||||
@REM popd
|
||||
@REM popd
|
||||
@REM echo "Failed to transfer shaders."
|
||||
@REM exit /b 1
|
||||
@REM )
|
||||
|
||||
@REM %adb% push --sync autoexec.cfg %ANDROID_STORAGE_LOCATION%/baseq3/
|
||||
@REM if %ERRORLEVEL% NEQ 0 (
|
||||
@REM popd
|
||||
@REM popd
|
||||
@REM echo "Failed to transfer autoexec."
|
||||
@REM exit /b 1
|
||||
@REM )
|
||||
|
||||
%adb% logcat -c
|
||||
%adb% shell am start -n %PACKAGE_NAME%/.MainActivity
|
||||
|
@ -104,4 +111,6 @@ if %ERRORLEVEL% NEQ 0 (
|
|||
exit 1
|
||||
)
|
||||
%adb% logcat *:S Quake3:V SDL:V DEBUG:V
|
||||
|
||||
:END
|
||||
endlocal
|
||||
|
|
|
@ -2685,20 +2685,28 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
cg.refdef.vieworg[2] -= PLAYER_HEIGHT;
|
||||
cg.refdef.vieworg[2] += vr->hmdposition[1] * worldscale;
|
||||
}
|
||||
else if (trap_Cvar_VariableValue("vr_mp6DoF") == 1.0f)
|
||||
else
|
||||
{
|
||||
//If connected to external server, allow some amount of faked positional tracking
|
||||
cg.refdef.vieworg[2] -= PLAYER_HEIGHT;
|
||||
cg.refdef.vieworg[2] += vr->hmdposition[1] * worldscale;
|
||||
if (cg.snap->ps.stats[STAT_HEALTH] > 0)
|
||||
{
|
||||
vec3_t pos, hmdposition;
|
||||
vec3_t pos, hmdposition, vieworg;
|
||||
VectorClear(pos);
|
||||
VectorSubtract(vr->hmdposition, vr->hmdorigin, hmdposition);
|
||||
rotateAboutOrigin(hmdposition[2], hmdposition[0],
|
||||
cg.refdefViewAngles[YAW] - vr->weaponangles[YAW], pos);
|
||||
VectorScale(pos, worldscale, pos);
|
||||
VectorSubtract(cg.refdef.vieworg, pos, cg.refdef.vieworg);
|
||||
VectorSubtract(cg.refdef.vieworg, pos, vieworg);
|
||||
|
||||
//Prevent player clipping through solid objects
|
||||
trace_t trace;
|
||||
vec3_t mins = {-8, -8, -8};
|
||||
vec3_t maxs = {8, 8, 8};
|
||||
CG_Trace(&trace, cg.refdef.vieworg, mins, maxs, vieworg, cg.snap->ps.clientNum, CONTENTS_SOLID|CONTENTS_BODY);
|
||||
|
||||
VectorCopy(trace.endpos, cg.refdef.vieworg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -259,8 +259,7 @@ void CG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles, qboolean crossh
|
|||
|
||||
if (!cgs.localServer)
|
||||
{
|
||||
if (trap_Cvar_VariableValue("vr_mp6DoF") == 1.0f &&
|
||||
!crosshair)
|
||||
if (!crosshair)
|
||||
{
|
||||
//Use absolute position for the faked 6DoF for multiplayer
|
||||
vec3_t offset, weaponposition;
|
||||
|
@ -275,14 +274,6 @@ void CG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles, qboolean crossh
|
|||
{
|
||||
vec3_t weaponoffset;
|
||||
VectorSet(weaponoffset, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
//Fixed point
|
||||
if (!crosshair) {
|
||||
vec2_t temp;
|
||||
rotateAboutOrigin(0.25f, -0.25f, -vr->hmdorientation[YAW], temp);
|
||||
VectorSet(weaponoffset, temp[0], -0.3f, temp[1]);
|
||||
}
|
||||
|
||||
CG_ConvertFromVR(weaponoffset, cg.refdef.vieworg, origin);
|
||||
}
|
||||
}
|
||||
|
@ -1309,7 +1300,8 @@ static void CG_LightningBolt( centity_t *cent, vec3_t origin ) {
|
|||
memset( &beam, 0, sizeof( beam ) );
|
||||
|
||||
// CPMA "true" lightning
|
||||
if ((cent->currentState.number == cg.predictedPlayerState.clientNum) && (cg_trueLightning.value != 0)) {
|
||||
if (cent->currentState.number == cg.predictedPlayerState.clientNum)// && (cg_trueLightning.value != 0))
|
||||
{
|
||||
vec3_t angle;
|
||||
CG_CalculateVRWeaponPosition(muzzlePoint, angle, qfalse);
|
||||
AngleVectors(angle, forward, NULL, NULL );
|
||||
|
|
|
@ -106,9 +106,19 @@ qboolean CheckGauntletAttack( gentity_t *ent ) {
|
|||
int damage;
|
||||
|
||||
// set aiming directions
|
||||
vec3_t angles;
|
||||
VectorCopy(vr->weaponangles, angles);
|
||||
angles[YAW] += (ent->client->ps.viewangles[YAW] - vr->hmdorientation[YAW]);
|
||||
vec3_t angles;
|
||||
if ( !( ent->r.svFlags & SVF_BOT ) &&
|
||||
vr != NULL &&
|
||||
(ent->client->ps.clientNum == vr->clientNum))
|
||||
{
|
||||
VectorCopy(vr->weaponangles, angles);
|
||||
angles[YAW] += ent->client->ps.viewangles[YAW] - vr->hmdorientation[YAW];
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy( ent->client->ps.viewangles, angles );
|
||||
}
|
||||
|
||||
AngleVectors (angles, forward, right, up);
|
||||
|
||||
CalcMuzzlePoint ( ent, forward, right, up, muzzle );
|
||||
|
@ -805,7 +815,9 @@ set muzzle location relative to pivoting eye
|
|||
===============
|
||||
*/
|
||||
void CalcMuzzlePoint ( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint ) {
|
||||
if ( ( ent->r.svFlags & SVF_BOT ) )
|
||||
if ( ( ent->r.svFlags & SVF_BOT ) ||
|
||||
//Can't use the vr_clientinfo if this isn't the vr client
|
||||
vr == NULL || (ent->client->ps.clientNum != vr->clientNum))
|
||||
{
|
||||
VectorCopy( ent->s.pos.trBase, muzzlePoint );
|
||||
muzzlePoint[2] += ent->client->ps.viewheight;
|
||||
|
@ -867,7 +879,9 @@ void FireWeapon( gentity_t *ent ) {
|
|||
}
|
||||
|
||||
vec3_t viewang;
|
||||
if ( !( ent->r.svFlags & SVF_BOT ) && vr != NULL)
|
||||
if ( !( ent->r.svFlags & SVF_BOT ) &&
|
||||
vr != NULL &&
|
||||
(ent->client->ps.clientNum == vr->clientNum))
|
||||
{
|
||||
VectorCopy(vr->weaponangles, viewang);
|
||||
viewang[YAW] += ent->client->ps.viewangles[YAW] - vr->hmdorientation[YAW];
|
||||
|
|
|
@ -20,6 +20,13 @@ static engine_t vr_engine;
|
|||
|
||||
cvar_t *vr_worldscale = NULL;
|
||||
cvar_t *vr_hudDepth = NULL;
|
||||
cvar_t *vr_righthanded = NULL;
|
||||
cvar_t *vr_snapturn = NULL;
|
||||
cvar_t *vr_heightAdjust = NULL;
|
||||
cvar_t *vr_extralatencymode = NULL;
|
||||
cvar_t *vr_directionMode = NULL;
|
||||
cvar_t *vr_weaponPitch = NULL;
|
||||
cvar_t *vr_twoHandedWeapons = NULL;
|
||||
|
||||
engine_t* VR_Init( ovrJava java )
|
||||
{
|
||||
|
@ -41,6 +48,13 @@ void VR_InitCvars( void )
|
|||
{
|
||||
vr_worldscale = Cvar_Get ("vr_worldscale", "32.0", CVAR_ARCHIVE);
|
||||
vr_hudDepth = Cvar_Get ("vr_hudDepth", "3", CVAR_ARCHIVE);
|
||||
vr_righthanded = Cvar_Get ("vr_righthanded", "1", CVAR_ARCHIVE);
|
||||
vr_snapturn = Cvar_Get ("vr_snapturn", "45", CVAR_ARCHIVE);
|
||||
vr_extralatencymode = Cvar_Get ("vr_extralatencymode", "1", CVAR_ARCHIVE);
|
||||
vr_directionMode = Cvar_Get ("vr_directionMode", "0", CVAR_ARCHIVE); // 0 = HMD, 1 = Off-hand
|
||||
vr_weaponPitch = Cvar_Get ("vr_weaponPitch", "-20", CVAR_ARCHIVE);
|
||||
vr_heightAdjust = Cvar_Get ("vr_heightAdjust", "0.0", CVAR_ARCHIVE);
|
||||
vr_twoHandedWeapons = Cvar_Get ("vr_twoHandedWeapons", "1", CVAR_ARCHIVE);
|
||||
|
||||
// Values are: scale,right,up,forward,pitch,yaw,roll
|
||||
// VALUES PROVIDED BY SkillFur - Thank-you!
|
||||
|
|
|
@ -48,10 +48,6 @@ extern cvar_t *cl_sensitivity;
|
|||
extern cvar_t *m_pitch;
|
||||
extern cvar_t *m_yaw;
|
||||
|
||||
cvar_t *vr_righthanded;
|
||||
cvar_t *vr_snapturn;
|
||||
|
||||
|
||||
float radians(float deg) {
|
||||
return (deg * M_PI) / 180.0;
|
||||
}
|
||||
|
@ -65,9 +61,13 @@ float degrees(float rad) {
|
|||
#define EPSILON 0.001f
|
||||
#endif
|
||||
|
||||
cvar_t *vr_extralatencymode = NULL;
|
||||
cvar_t *vr_directionMode = NULL;
|
||||
cvar_t *vr_mp6DoF = NULL;
|
||||
extern cvar_t *vr_righthanded;
|
||||
extern cvar_t *vr_snapturn;
|
||||
extern cvar_t *vr_extralatencymode;
|
||||
extern cvar_t *vr_directionMode;
|
||||
extern cvar_t *vr_weaponPitch;
|
||||
extern cvar_t *vr_heightAdjust;
|
||||
extern cvar_t *vr_twoHandedWeapons;
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out)
|
||||
{
|
||||
|
@ -193,12 +193,6 @@ static float length(float x, float y)
|
|||
|
||||
void IN_VRInit( void )
|
||||
{
|
||||
vr_righthanded = Cvar_Get ("vr_righthanded", "1", CVAR_ARCHIVE);
|
||||
vr_snapturn = Cvar_Get ("vr_snapturn", "45", CVAR_ARCHIVE);
|
||||
vr_extralatencymode = Cvar_Get ("vr_extralatencymode", "1", CVAR_ARCHIVE);
|
||||
vr_directionMode = Cvar_Get ("vr_directionMode", "0", CVAR_ARCHIVE); // 0 = HMD, 1 = Off-hand
|
||||
vr_mp6DoF = Cvar_Get ("vr_mp6DoF", "1", CVAR_ARCHIVE); // if 0 then multiplayer will use only 3DoF for headset
|
||||
|
||||
memset(&vr, 0, sizeof(vr));
|
||||
}
|
||||
|
||||
|
@ -209,7 +203,7 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
|
|||
{
|
||||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] =-20.0f;
|
||||
rotation[PITCH] = vr_weaponPitch->value;
|
||||
QuatToYawPitchRoll(remoteTracking.HeadPose.Pose.Orientation, rotation, vr.weaponangles);
|
||||
|
||||
VectorSubtract(vr.weaponangles_last, vr.weaponangles, vr.weaponangles_delta);
|
||||
|
@ -217,12 +211,12 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
|
|||
|
||||
///Weapon location relative to view
|
||||
vr.weaponposition[0] = remoteTracking.HeadPose.Pose.Position.x;
|
||||
vr.weaponposition[1] = remoteTracking.HeadPose.Pose.Position.y;
|
||||
vr.weaponposition[1] = remoteTracking.HeadPose.Pose.Position.y + vr_heightAdjust->value;
|
||||
vr.weaponposition[2] = remoteTracking.HeadPose.Pose.Position.z;
|
||||
|
||||
vr.weaponoffset[0] = remoteTracking.HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.weaponoffset[1] = remoteTracking.HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.weaponoffset[2] = remoteTracking.HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
vr.weaponoffset[0] = vr.weaponposition[0] - vr.hmdposition[0];
|
||||
vr.weaponoffset[1] = vr.weaponposition[1] - vr.hmdposition[1];
|
||||
vr.weaponoffset[2] = vr.weaponposition[2] - vr.hmdposition[2];
|
||||
|
||||
|
||||
if (vr.virtual_screen ||
|
||||
|
@ -233,20 +227,20 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
|
|||
}
|
||||
} else {
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] =-20.0f;
|
||||
rotation[PITCH] = vr_weaponPitch->value;
|
||||
QuatToYawPitchRoll(remoteTracking.HeadPose.Pose.Orientation, rotation, vr.offhandangles);
|
||||
|
||||
///location relative to view
|
||||
vr.offhandposition[0] = remoteTracking.HeadPose.Pose.Position.x;
|
||||
vr.offhandposition[1] = remoteTracking.HeadPose.Pose.Position.y;
|
||||
vr.offhandposition[1] = remoteTracking.HeadPose.Pose.Position.y + vr_heightAdjust->value;
|
||||
vr.offhandposition[2] = remoteTracking.HeadPose.Pose.Position.z;
|
||||
|
||||
vr.offhandoffset[0] = remoteTracking.HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.offhandoffset[1] = remoteTracking.HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.offhandoffset[2] = remoteTracking.HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
vr.offhandoffset[0] = vr.offhandposition[0] - vr.hmdposition[0];
|
||||
vr.offhandoffset[1] = vr.offhandposition[1] - vr.hmdposition[1];
|
||||
vr.offhandoffset[2] = vr.offhandposition[2] - vr.hmdposition[2];
|
||||
}
|
||||
|
||||
if (vr.weapon_stabilised)
|
||||
if (vr_twoHandedWeapons->integer && vr.weapon_stabilised)
|
||||
{
|
||||
float x = vr.offhandoffset[0] - vr.weaponoffset[0];
|
||||
float y = vr.offhandoffset[1] - vr.weaponoffset[1];
|
||||
|
@ -471,12 +465,11 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
|
|||
//Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_X, qfalse, 0, NULL);
|
||||
}
|
||||
|
||||
// Y button - unassigned right now
|
||||
if ((buttons & ovrButton_Y) && !(controller->buttons & ovrButton_Y)) {
|
||||
int thirdPerson = Cvar_VariableIntegerValue("cg_thirdPerson");
|
||||
Cvar_SetValue("cg_thirdPerson", 1-thirdPerson);
|
||||
//Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_Y, qtrue, 0, NULL);
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_Y, qtrue, 0, NULL);
|
||||
} else if (!(buttons & ovrButton_Y) && (controller->buttons & ovrButton_Y)) {
|
||||
//Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_Y, qfalse, 0, NULL);
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_Y, qfalse, 0, NULL);
|
||||
}
|
||||
|
||||
controller->buttons = buttons;
|
||||
|
@ -514,7 +507,7 @@ void IN_VRInputFrame( void )
|
|||
const ovrVector3f positionHmd = VR_GetEngine()->tracking.HeadPose.Pose.Position;
|
||||
vec3_t rotation = {0, 0, 0};
|
||||
QuatToYawPitchRoll(quatHmd, rotation, vr.hmdorientation);
|
||||
VectorSet(vr.hmdposition, positionHmd.x, positionHmd.y, positionHmd.z);
|
||||
VectorSet(vr.hmdposition, positionHmd.x, positionHmd.y + vr_heightAdjust->value, positionHmd.z);
|
||||
|
||||
//Position
|
||||
VectorSubtract(vr.hmdposition_last, vr.hmdposition, vr.hmdposition_delta);
|
||||
|
|
|
@ -244,7 +244,7 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
const ovrMatrix4f projectionMatrix = ovrMatrix4f_CreateProjectionFov(
|
||||
fov_x, fov_y, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
|
||||
static int playerYaw = 0;
|
||||
static float playerYaw = 0;
|
||||
|
||||
int eyeW, eyeH;
|
||||
VR_GetResolution(engine, &eyeW, &eyeH);
|
||||
|
|
Loading…
Reference in a new issue