mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-02-18 10:01:28 +00:00
Several significant changes
- Fixed bug where player would randomly move around - Changed package name to com.drbeef.ioq3quest - Changed location of files to /sdcard/ioquake3quest - Added commandline.txt file - Intermission screen now has headtracking (and in skirmish is a full VR experience) - Fixed projectile location of railgun - Made HUD model icons larger
This commit is contained in:
parent
2524be5017
commit
5066bb9431
15 changed files with 251 additions and 77 deletions
|
@ -5,7 +5,7 @@ android {
|
||||||
buildToolsVersion "29.0.2"
|
buildToolsVersion "29.0.2"
|
||||||
ndkVersion "21.1.6352462"
|
ndkVersion "21.1.6352462"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = 'com.sparkie.ioq3quest'
|
applicationId = 'com.drbeef.ioq3quest'
|
||||||
minSdkVersion 25
|
minSdkVersion 25
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 1
|
versionCode 1
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.sparkie.ioq3quest"
|
package="com.drbeef.ioq3quest"
|
||||||
android:installLocation="preferExternal"
|
android:installLocation="preferExternal"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.0">
|
android:versionName="1.0">
|
||||||
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
|
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
|
||||||
<uses-feature android:glEsVersion="0x00030001" />
|
<uses-feature android:glEsVersion="0x00030001" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
|
@ -16,7 +21,7 @@
|
||||||
android:hasCode="true">
|
android:hasCode="true">
|
||||||
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
|
<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.supportedDevices" android:value="quest|quest2"/>
|
||||||
<activity android:name="com.sparkie.ioq3quest.MainActivity"
|
<activity android:name="com.drbeef.ioq3quest.MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
|
||||||
|
|
|
@ -31,7 +31,7 @@ static jobject g_ActivityObject = NULL;
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
JNIEXPORT void JNICALL Java_com_sparkie_ioq3quest_MainActivity_nativeCreate(JNIEnv* env, jclass cls, jobject thisObject)
|
JNIEXPORT void JNICALL Java_com_drbeef_ioq3quest_MainActivity_nativeCreate(JNIEnv* env, jclass cls, jobject thisObject)
|
||||||
{
|
{
|
||||||
g_ActivityObject = env->NewGlobalRef(thisObject);
|
g_ActivityObject = env->NewGlobalRef(thisObject);
|
||||||
}
|
}
|
||||||
|
@ -73,15 +73,9 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
CON_LogcatFn(&ioq3_logfn);
|
CON_LogcatFn(&ioq3_logfn);
|
||||||
|
|
||||||
std::string defaultArgs("+set fs_basepath ");
|
char *args = (char*)getenv("commandline");
|
||||||
defaultArgs += SDL_AndroidGetExternalStoragePath();
|
|
||||||
// defaultArgs += " +set fs_game baseq3 +map q3dm6";
|
|
||||||
defaultArgs += " +set fs_game baseq3";
|
|
||||||
|
|
||||||
char* args = new char[defaultArgs.length() + 1];
|
Com_Init(args);
|
||||||
args[defaultArgs.length()] = '\0';
|
|
||||||
memcpy(args, defaultArgs.c_str(), defaultArgs.length());
|
|
||||||
Com_Init(args);
|
|
||||||
|
|
||||||
VR_InitRenderer(engine);
|
VR_InitRenderer(engine);
|
||||||
|
|
||||||
|
@ -112,6 +106,5 @@ int main(int argc, char* argv[]) {
|
||||||
Com_Shutdown();
|
Com_Shutdown();
|
||||||
VR_Destroy(engine);
|
VR_Destroy(engine);
|
||||||
|
|
||||||
delete [] args;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
162
android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java
Normal file
162
android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
package com.drbeef.ioq3quest;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.AssetManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import org.libsdl.app.SDLActivity;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import static android.system.Os.setenv;
|
||||||
|
|
||||||
|
public class MainActivity extends SDLActivity
|
||||||
|
{
|
||||||
|
private int permissionCount = 0;
|
||||||
|
private static final int READ_EXTERNAL_STORAGE_PERMISSION_ID = 1;
|
||||||
|
private static final int WRITE_EXTERNAL_STORAGE_PERMISSION_ID = 2;
|
||||||
|
private static final String TAG = "ioquake3Quest";
|
||||||
|
|
||||||
|
String commandLineParams;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Log.i(TAG,"onCreate called");
|
||||||
|
checkPermissionsAndInitialize();
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes the Activity only if the permission has been granted. */
|
||||||
|
private void checkPermissionsAndInitialize() {
|
||||||
|
// Boilerplate for checking runtime permissions in Android.
|
||||||
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED){
|
||||||
|
ActivityCompat.requestPermissions(this,
|
||||||
|
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||||
|
WRITE_EXTERNAL_STORAGE_PERMISSION_ID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Permissions have already been granted.
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Handles the user accepting the permission. */
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] results) {
|
||||||
|
if (requestCode == WRITE_EXTERNAL_STORAGE_PERMISSION_ID) {
|
||||||
|
finish();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
Log.d(TAG, "making dirs");
|
||||||
|
//Make the directories
|
||||||
|
new File("/sdcard/ioquake3Quest/").mkdirs();
|
||||||
|
|
||||||
|
Log.d(TAG, "copying commandline.txt");
|
||||||
|
//Copy the command line params file
|
||||||
|
copy_asset("/sdcard/ioquake3Quest", "commandline.txt", false);
|
||||||
|
|
||||||
|
//Read these from a file and pass through
|
||||||
|
commandLineParams = new String();
|
||||||
|
|
||||||
|
Log.d(TAG, "reading commandline.txt");
|
||||||
|
//See if user is trying to use command line params
|
||||||
|
if (new File("/sdcard/ioquake3Quest/commandline.txt").exists())
|
||||||
|
{
|
||||||
|
BufferedReader br;
|
||||||
|
try {
|
||||||
|
br = new BufferedReader(new FileReader("/sdcard/ioquake3Quest/commandline.txt"));
|
||||||
|
String s;
|
||||||
|
StringBuilder sb = new StringBuilder(0);
|
||||||
|
while ((s = br.readLine()) != null)
|
||||||
|
sb.append(s + " ");
|
||||||
|
br.close();
|
||||||
|
|
||||||
|
commandLineParams = new String(sb.toString());
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d(TAG, "setting env");
|
||||||
|
try {
|
||||||
|
setenv("commandline", commandLineParams, true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d(TAG, "nativeCreate");
|
||||||
|
nativeCreate(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void copy_asset(String path, String name, boolean force) {
|
||||||
|
File f = new File(path + "/" + name);
|
||||||
|
if (!f.exists() || force) {
|
||||||
|
|
||||||
|
//Ensure we have an appropriate folder
|
||||||
|
String fullname = path + "/" + name;
|
||||||
|
String directory = fullname.substring(0, fullname.lastIndexOf("/"));
|
||||||
|
new File(directory).mkdirs();
|
||||||
|
_copy_asset(name, path + "/" + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _copy_asset(String name_in, String name_out) {
|
||||||
|
AssetManager assets = this.getAssets();
|
||||||
|
|
||||||
|
try {
|
||||||
|
InputStream in = assets.open(name_in);
|
||||||
|
OutputStream out = new FileOutputStream(name_out);
|
||||||
|
|
||||||
|
copy_stream(in, out);
|
||||||
|
|
||||||
|
out.close();
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void copy_stream(InputStream in, OutputStream out)
|
||||||
|
throws IOException {
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
while (true) {
|
||||||
|
int count = in.read(buf);
|
||||||
|
if (count <= 0)
|
||||||
|
break;
|
||||||
|
out.write(buf, 0, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static native void nativeCreate(MainActivity thisObject);
|
||||||
|
|
||||||
|
static {
|
||||||
|
System.loadLibrary("main");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
package com.sparkie.ioq3quest;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import org.libsdl.app.SDLActivity;
|
|
||||||
|
|
||||||
public class MainActivity extends SDLActivity
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
nativeCreate(this);
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static native void nativeCreate(MainActivity thisObject);
|
|
||||||
|
|
||||||
static {
|
|
||||||
System.loadLibrary("main");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">NativeActivity</string>
|
<string name="app_name">ioquake3Quest</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2,13 +2,28 @@
|
||||||
|
|
||||||
setlocal
|
setlocal
|
||||||
|
|
||||||
|
set BUILD_TYPE=debug
|
||||||
|
set KEYSTORE=
|
||||||
|
set KEYSTORE_PASS=
|
||||||
|
set VERSION=0.6.0
|
||||||
|
|
||||||
set ANDROID_SDK_ROOT=%AppData%\..\Local\Android\Sdk
|
set ANDROID_SDK_ROOT=%AppData%\..\Local\Android\Sdk
|
||||||
set adb="%ANDROID_SDK_ROOT%\platform-tools\adb.exe"
|
set adb="%ANDROID_SDK_ROOT%\platform-tools\adb.exe"
|
||||||
set make="%ANDROID_SDK_ROOT%\ndk\21.1.6352462\prebuilt\windows-x86_64\bin\make.exe"
|
set make="%ANDROID_SDK_ROOT%\ndk\21.1.6352462\prebuilt\windows-x86_64\bin\make.exe"
|
||||||
set apksigner="%ANDROID_SDK_ROOT%\build-tools\29.0.2\apksigner.bat"
|
set apksigner="%ANDROID_SDK_ROOT%\build-tools\29.0.2\apksigner.bat"
|
||||||
set JAVA_HOME=C:\Program Files\Android\Android Studio\jre\jre
|
set JAVA_HOME=C:\Program Files\Android\Android Studio\jre\jre
|
||||||
set BUILD_TYPE=release
|
|
||||||
set GRADLE_BUILD_TYPE=:app:assembleRelease
|
if "%1"=="clean" (
|
||||||
|
rm -rf .\build
|
||||||
|
rm -rf .\android\build
|
||||||
|
)
|
||||||
|
|
||||||
|
if %BUILD_TYPE%==release (
|
||||||
|
set GRADLE_BUILD_TYPE=:app:assembleRelease
|
||||||
|
)
|
||||||
|
if %BUILD_TYPE%==debug (
|
||||||
|
set GRADLE_BUILD_TYPE=:app:assembleDebug
|
||||||
|
)
|
||||||
|
|
||||||
pushd %~dp0\..
|
pushd %~dp0\..
|
||||||
%make% -j %NUMBER_OF_PROCESSORS% %BUILD_TYPE%
|
%make% -j %NUMBER_OF_PROCESSORS% %BUILD_TYPE%
|
||||||
|
@ -31,11 +46,19 @@ if %ERRORLEVEL% NEQ 0 (
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
set PACKAGE_NAME=com.sparkie.ioq3quest
|
set PACKAGE_NAME=com.drbeef.ioq3quest
|
||||||
set ANDROID_STORAGE_LOCATION=/sdcard/Android/data/%PACKAGE_NAME%/files/
|
set ANDROID_STORAGE_LOCATION=/sdcard/ioquake3quest/
|
||||||
set APK_LOCATION=.\app\build\outputs\apk\%BUILD_TYPE%\app-%BUILD_TYPE%.apk
|
set APK_LOCATION=.\app\build\outputs\apk\%BUILD_TYPE%\ioq3quest-%BUILD_TYPE%-%VERSION%.apk
|
||||||
|
|
||||||
REM %apksigner% sign --ks ../drbeef-release-key.keystore --out %APK_LOCATION% .\app\build\outputs\apk\%BUILD_TYPE%\app-%BUILD_TYPE%-unsigned.apk
|
if %BUILD_TYPE%==release (
|
||||||
|
echo "Signing Release APK"
|
||||||
|
call %apksigner% sign --ks ../%KEYSTORE% --out %APK_LOCATION% --v2-signing-enabled true --ks-pass pass:%KEYSTORE_PASS% .\app\build\outputs\apk\%BUILD_TYPE%\app-%BUILD_TYPE%-unsigned.apk
|
||||||
|
)
|
||||||
|
|
||||||
|
if %BUILD_TYPE%==debug (
|
||||||
|
echo "Copying Debug APK"
|
||||||
|
copy .\app\build\outputs\apk\%BUILD_TYPE%\app-%BUILD_TYPE%.apk %APK_LOCATION%
|
||||||
|
)
|
||||||
|
|
||||||
%adb% install -r %APK_LOCATION%
|
%adb% install -r %APK_LOCATION%
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
if %ERRORLEVEL% NEQ 0 (
|
||||||
|
|
|
@ -47,8 +47,7 @@ Adjusted for resolution and screen aspect ratio
|
||||||
*/
|
*/
|
||||||
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
|
|
||||||
if (hudflags & HUD_FLAGS_FULLSCREEN ||
|
if (cgVR->virtual_screen)
|
||||||
cgVR->virtual_screen)
|
|
||||||
{
|
{
|
||||||
// scale for screen sizes
|
// scale for screen sizes
|
||||||
*x *= cgs.screenXScale;
|
*x *= cgs.screenXScale;
|
||||||
|
@ -70,10 +69,10 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
*y *= screenYScale;
|
*y *= screenYScale;
|
||||||
if (hudflags & HUD_FLAGS_DRAWMODEL)
|
if (hudflags & HUD_FLAGS_DRAWMODEL)
|
||||||
{
|
{
|
||||||
*w *= cgs.screenXScale;
|
*w *= (cgs.screenXScale * 2.0f);
|
||||||
*x -= (*w / 4);
|
*x -= (*w / 3);
|
||||||
*h *= cgs.screenYScale;
|
*h *= (cgs.screenYScale * 2.0f);
|
||||||
*y -= (*h / 4);
|
*y -= (*h / 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,8 +96,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define DEFAULT_REDTEAM_NAME "Stroggs"
|
#define DEFAULT_REDTEAM_NAME "Stroggs"
|
||||||
#define DEFAULT_BLUETEAM_NAME "Pagans"
|
#define DEFAULT_BLUETEAM_NAME "Pagans"
|
||||||
//VR HUD
|
//VR HUD
|
||||||
#define HUD_FLAGS_FULLSCREEN 1
|
#define HUD_FLAGS_DRAWMODEL 1
|
||||||
#define HUD_FLAGS_DRAWMODEL 2
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FOOTSTEP_NORMAL,
|
FOOTSTEP_NORMAL,
|
||||||
|
|
|
@ -341,9 +341,9 @@ static void CG_OffsetFirstPersonView( void ) {
|
||||||
vec3_t predictedVelocity;
|
vec3_t predictedVelocity;
|
||||||
int timeDelta;
|
int timeDelta;
|
||||||
|
|
||||||
// if ( cg.snap->ps.pm_type == PM_INTERMISSION ) {
|
if ( cg.snap->ps.pm_type == PM_INTERMISSION ) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
origin = cg.refdef.vieworg;
|
origin = cg.refdef.vieworg;
|
||||||
angles = cg.refdefViewAngles;
|
angles = cg.refdefViewAngles;
|
||||||
|
@ -646,15 +646,19 @@ static int CG_CalcViewValues( void ) {
|
||||||
cg.cameraMode = qfalse;
|
cg.cameraMode = qfalse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// intermission view
|
// intermission view
|
||||||
|
static float hmdYaw = 0;
|
||||||
if ( ps->pm_type == PM_INTERMISSION ) {
|
if ( ps->pm_type == PM_INTERMISSION ) {
|
||||||
VectorCopy( ps->origin, cg.refdef.vieworg );
|
VectorCopy( ps->origin, cg.refdef.vieworg );
|
||||||
VectorCopy( ps->viewangles, cg.refdefViewAngles );
|
VectorCopy(cgVR->hmdorientation, cg.refdefViewAngles);
|
||||||
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
|
cg.refdefViewAngles[YAW] += (ps->viewangles[YAW] - hmdYaw);
|
||||||
|
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
|
||||||
return CG_CalcFov();
|
return CG_CalcFov();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
hmdYaw = cgVR->hmdorientation[YAW];
|
||||||
|
|
||||||
cg.bobcycle = ( ps->bobCycle & 128 ) >> 7;
|
cg.bobcycle = ( ps->bobCycle & 128 ) >> 7;
|
||||||
cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) );
|
cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) );
|
||||||
cg.xyspeed = sqrt( ps->velocity[0] * ps->velocity[0] +
|
cg.xyspeed = sqrt( ps->velocity[0] * ps->velocity[0] +
|
||||||
|
|
|
@ -534,8 +534,8 @@ void CG_RailTrail (clientInfo_t *ci, vec3_t start, vec3_t end) {
|
||||||
if (cg_oldRail.integer)
|
if (cg_oldRail.integer)
|
||||||
{
|
{
|
||||||
// nudge down a bit so it isn't exactly in center
|
// nudge down a bit so it isn't exactly in center
|
||||||
re->origin[2] -= 8;
|
//re->origin[2] -= 8;
|
||||||
re->oldorigin[2] -= 8;
|
//re->oldorigin[2] -= 8;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1797,11 +1797,11 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) {
|
||||||
short temp;
|
short temp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
|
||||||
if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION) {
|
if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION) {
|
||||||
return; // no view changes at all
|
return; // no view changes at all
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/* We want to allow user to look around if they are dead
|
/* We want to allow user to look around if they are dead
|
||||||
if ( ps->pm_type != PM_SPECTATOR && ps->stats[STAT_HEALTH] <= 0 ) {
|
if ( ps->pm_type != PM_SPECTATOR && ps->stats[STAT_HEALTH] <= 0 ) {
|
||||||
return; // no view changes at all
|
return; // no view changes at all
|
||||||
|
|
|
@ -48,7 +48,7 @@ void VR_InitCvars( void )
|
||||||
Cvar_Get ("vr_weapon_adjustment_4", "0.75,-4.0,6.5,-4,0,0,0", CVAR_ARCHIVE);
|
Cvar_Get ("vr_weapon_adjustment_4", "0.75,-4.0,6.5,-4,0,0,0", CVAR_ARCHIVE);
|
||||||
Cvar_Get ("vr_weapon_adjustment_5", "0.8,-3.8,6,7.5,0,0,0", CVAR_ARCHIVE);
|
Cvar_Get ("vr_weapon_adjustment_5", "0.8,-3.8,6,7.5,0,0,0", CVAR_ARCHIVE);
|
||||||
Cvar_Get ("vr_weapon_adjustment_6", "0.8,-3.3,6,7,0,0,0", CVAR_ARCHIVE);
|
Cvar_Get ("vr_weapon_adjustment_6", "0.8,-3.3,6,7,0,0,0", CVAR_ARCHIVE);
|
||||||
Cvar_Get ("vr_weapon_adjustment_7", "0.8,-3.3,6,0,0,0,0", CVAR_ARCHIVE);
|
Cvar_Get ("vr_weapon_adjustment_7", "0.8,-3.0,6,0,0,0,0", CVAR_ARCHIVE);
|
||||||
Cvar_Get ("vr_weapon_adjustment_8", "0.8,-3.5,6,1.5,0,0,0", CVAR_ARCHIVE);
|
Cvar_Get ("vr_weapon_adjustment_8", "0.8,-3.5,6,1.5,0,0,0", CVAR_ARCHIVE);
|
||||||
Cvar_Get ("vr_weapon_adjustment_9", "0.8,-5.5,6,0,0,0,0", CVAR_ARCHIVE);
|
Cvar_Get ("vr_weapon_adjustment_9", "0.8,-5.5,6,0,0,0,0", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ void VR_EnterVR( engine_t* engine, ovrJava java ) {
|
||||||
engine->frameIndex = 0;
|
engine->frameIndex = 0;
|
||||||
|
|
||||||
vrapi_SetTrackingSpace(engine->ovr, VRAPI_TRACKING_SPACE_LOCAL_FLOOR);
|
vrapi_SetTrackingSpace(engine->ovr, VRAPI_TRACKING_SPACE_LOCAL_FLOOR);
|
||||||
|
|
||||||
|
vrapi_SetClockLevels(engine->ovr, 4, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,9 +90,14 @@ engine_t* VR_GetEngine( void ) {
|
||||||
|
|
||||||
bool VR_useScreenLayer( void )
|
bool VR_useScreenLayer( void )
|
||||||
{
|
{
|
||||||
int keyCatcher = Key_GetCatcher( );
|
//intermission is never full screen
|
||||||
|
/* if ( cl.snap.ps.pm_type == PM_INTERMISSION )
|
||||||
|
{
|
||||||
|
return qfalse;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
int keyCatcher = Key_GetCatcher( );
|
||||||
return (bool)( clc.state != CA_ACTIVE ||
|
return (bool)( clc.state != CA_ACTIVE ||
|
||||||
//( cl.snap.ps.stats[STAT_HEALTH] <= 0 ) ||
|
|
||||||
( keyCatcher & (KEYCATCH_UI | KEYCATCH_CONSOLE) ));
|
( keyCatcher & (KEYCATCH_UI | KEYCATCH_CONSOLE) ));
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
|
|
|
@ -38,6 +38,7 @@ static qboolean controllerInit = qfalse;
|
||||||
static vrController_t leftController;
|
static vrController_t leftController;
|
||||||
static vrController_t rightController;
|
static vrController_t rightController;
|
||||||
static int in_vrEventTime = 0;
|
static int in_vrEventTime = 0;
|
||||||
|
static double lastframetime = 0;
|
||||||
|
|
||||||
static float pressedThreshold = 0.75f;
|
static float pressedThreshold = 0.75f;
|
||||||
static float releasedThreshold = 0.5f;
|
static float releasedThreshold = 0.5f;
|
||||||
|
@ -252,18 +253,6 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
{
|
{
|
||||||
vrController_t* controller = isRightController == qtrue ? &rightController : &leftController;
|
vrController_t* controller = isRightController == qtrue ? &rightController : &leftController;
|
||||||
|
|
||||||
//Positional movement speed correction for when we are not hitting target framerate
|
|
||||||
static double lastframetime = 0;
|
|
||||||
int refresh = vrapi_GetSystemPropertyInt(&(VR_GetEngine()->java), VRAPI_SYS_PROP_DISPLAY_REFRESH_RATE);
|
|
||||||
double newframetime = Sys_Milliseconds();
|
|
||||||
float multiplier = (float)((1000.0 / refresh) / (newframetime - lastframetime));
|
|
||||||
lastframetime = newframetime;
|
|
||||||
|
|
||||||
vec2_t positional;
|
|
||||||
float factor = (refresh / 72.0F) * 10.0f; // adjust positional factor based on refresh rate
|
|
||||||
rotateAboutOrigin(-vr.hmdposition_delta[0] * factor * multiplier,
|
|
||||||
vr.hmdposition_delta[2] * factor * multiplier, - vr.hmdorientation[YAW], positional);
|
|
||||||
|
|
||||||
if (vr.virtual_screen)
|
if (vr.virtual_screen)
|
||||||
{
|
{
|
||||||
const float x = joystickX * 5.0;
|
const float x = joystickX * 5.0;
|
||||||
|
@ -273,6 +262,15 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (isRightController == qfalse) {
|
if (isRightController == qfalse) {
|
||||||
|
//Positional movement speed correction for when we are not hitting target framerate
|
||||||
|
int refresh = vrapi_GetSystemPropertyInt(&(VR_GetEngine()->java), VRAPI_SYS_PROP_DISPLAY_REFRESH_RATE);
|
||||||
|
float multiplier = (float)((1000.0 / refresh) / (in_vrEventTime - lastframetime));
|
||||||
|
|
||||||
|
vec2_t positional;
|
||||||
|
float factor = (refresh / 72.0F) * 10.0f; // adjust positional factor based on refresh rate
|
||||||
|
rotateAboutOrigin(-vr.hmdposition_delta[0] * factor * multiplier,
|
||||||
|
vr.hmdposition_delta[2] * factor * multiplier, - vr.hmdorientation[YAW], positional);
|
||||||
|
|
||||||
//sideways
|
//sideways
|
||||||
Com_QueueEvent(in_vrEventTime, SE_JOYSTICK_AXIS, 0, joystickX * 127.0f + positional[0] * 127.0f, 0, NULL);
|
Com_QueueEvent(in_vrEventTime, SE_JOYSTICK_AXIS, 0, joystickX * 127.0f + positional[0] * 127.0f, 0, NULL);
|
||||||
|
|
||||||
|
@ -374,7 +372,9 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((buttons & ovrButton_X) && !(controller->buttons & ovrButton_X)) {
|
if ((buttons & ovrButton_X) && !(controller->buttons & ovrButton_X)) {
|
||||||
//sendButtonActionSimple("give all");
|
#ifdef DEBUG
|
||||||
|
sendButtonActionSimple("fraglimit 1");
|
||||||
|
#endif
|
||||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_X, qtrue, 0, NULL);
|
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_X, qtrue, 0, NULL);
|
||||||
} else if (!(buttons & ovrButton_X) && (controller->buttons & ovrButton_X)) {
|
} else if (!(buttons & ovrButton_X) && (controller->buttons & ovrButton_X)) {
|
||||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_X, qfalse, 0, NULL);
|
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_X, qfalse, 0, NULL);
|
||||||
|
@ -494,6 +494,7 @@ void IN_VRInputFrame( void )
|
||||||
IN_VRTriggers(isRight, state.IndexTrigger);
|
IN_VRTriggers(isRight, state.IndexTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastframetime = in_vrEventTime;
|
||||||
in_vrEventTime = Sys_Milliseconds( );
|
in_vrEventTime = Sys_Milliseconds( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,11 +259,11 @@ void VR_DrawFrame( engine_t* engine ) {
|
||||||
const framebuffer_t* framebuffers = engine->framebuffers;
|
const framebuffer_t* framebuffers = engine->framebuffers;
|
||||||
|
|
||||||
//Now using a symmetrical render target, based on the horizontal FOV
|
//Now using a symmetrical render target, based on the horizontal FOV
|
||||||
float fov = vrapi_GetSystemPropertyInt( engine->ovr, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_Y);
|
//float fov = vrapi_GetSystemPropertyInt( engine->ovr, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_Y);
|
||||||
|
|
||||||
// Setup the projection matrix.
|
// Setup the projection matrix.
|
||||||
const ovrMatrix4f projectionMatrix = ovrMatrix4f_CreateProjectionFov(
|
const ovrMatrix4f projectionMatrix = ovrMatrix4f_CreateProjectionFov(
|
||||||
fov, fov, 0.0f, 0.0f, 1.0f, 0.0f );
|
90, 90, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||||
|
|
||||||
re.SetVRHeadsetParms(&projectionMatrix, &projectionMatrix,
|
re.SetVRHeadsetParms(&projectionMatrix, &projectionMatrix,
|
||||||
framebuffers[0].framebuffers[framebuffers[0].swapchainIndex],
|
framebuffers[0].framebuffers[framebuffers[0].swapchainIndex],
|
||||||
|
|
Loading…
Reference in a new issue