Getting it building...

..but not there yet
This commit is contained in:
Simon 2020-06-28 14:41:34 +01:00
parent 371ed1d9e2
commit 15880317b4
31 changed files with 109 additions and 110 deletions

View file

@ -1,8 +1,8 @@
<?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.drbeef.quake2quest" package="com.drbeef.rtcwquest"
android:versionCode="13" android:versionCode="1"
android:versionName="1.0.2" android:installLocation="auto" > android:versionName="0.1.0" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. --> <!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/> <uses-feature android:glEsVersion="0x00030001" android:required="true"/>
@ -16,7 +16,7 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:allowBackup="false" android:icon="@drawable/ic_qquest" android:label="@string/quake2quest"> <application android:allowBackup="false" android:icon="@drawable/ic_rtcwquest" android:label="@string/rtcwquest">
<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"/>
<!-- The activity is the built-in NativeActivity framework class. --> <!-- The activity is the built-in NativeActivity framework class. -->
<!-- launchMode is set to singleTask because there should never be multiple copies of the app running. --> <!-- launchMode is set to singleTask because there should never be multiple copies of the app running. -->
@ -24,15 +24,15 @@
<!-- If targeting API level 24+, configChanges should additionally include 'density'. --> <!-- If targeting API level 24+, configChanges should additionally include 'density'. -->
<!-- If targeting API level 24+, android:resizeableActivity="false" should be added. --> <!-- If targeting API level 24+, android:resizeableActivity="false" should be added. -->
<activity <activity
android:name="com.drbeef.quake2quest.GLES3JNIActivity" android:name="com.drbeef.rtcwquest.GLES3JNIActivity"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:label="@string/quake2quest" android:label="@string/rtcwquest"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="landscape" android:screenOrientation="landscape"
android:excludeFromRecents="false" android:excludeFromRecents="false"
android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode"> android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode">
<!-- Tell NativeActivity the name of the .so --> <!-- Tell NativeActivity the name of the .so -->
<meta-data android:name="android.app.lib_name" android:value="quake2quest" /> <meta-data android:name="android.app.lib_name" android:value="rtcwquest" />
<!-- This filter lets the apk show up as a launchable icon. --> <!-- This filter lets the apk show up as a launchable icon. -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View file

@ -6,7 +6,7 @@ android {
// -debug.apk or -release.apk appended to it. // -debug.apk or -release.apk appended to it.
// The filename doesn't effect the Android installation process. // The filename doesn't effect the Android installation process.
// Use only letters to remain compatible with the package name. // Use only letters to remain compatible with the package name.
project.archivesBaseName = "quake2quest" project.archivesBaseName = "rtcwquest"
defaultConfig { defaultConfig {
// Gradle replaces the manifest package with this value, which must // Gradle replaces the manifest package with this value, which must

View file

@ -1,6 +1,6 @@
/************************************************************************************ /************************************************************************************
Filename : Q2VR_SurfaceView.c based on VrCubeWorld_SurfaceView.c Filename : RTCWVR_SurfaceView.c based on VrCubeWorld_SurfaceView.c
Content : This sample uses a plain Android SurfaceView and handles all Content : This sample uses a plain Android SurfaceView and handles all
Activity and Surface life cycle events in native code. This sample Activity and Surface life cycle events in native code. This sample
does not use the application framework and also does not use LibOVR. does not use the application framework and also does not use LibOVR.
@ -41,15 +41,13 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved.
#include <src/gl/loader.h> #include <src/gl/loader.h>
#include <SDL2/SDL.h> //#include <SDL2/SDL.h>
#include <SDL2/SDL_main.h> //#include <SDL2/SDL_main.h>
#include <src/client/header/client.h> #include <src/client/client.h>
#include "VrCompositor.h" #include "VrCompositor.h"
#include "VrInput.h" #include "VrInput.h"
#include "../quake2/src/client/header/client.h"
#if !defined( EGL_OPENGL_ES3_BIT_KHR ) #if !defined( EGL_OPENGL_ES3_BIT_KHR )
#define EGL_OPENGL_ES3_BIT_KHR 0x0040 #define EGL_OPENGL_ES3_BIT_KHR 0x0040
#endif #endif
@ -137,14 +135,14 @@ LAMBDA1VR Stuff
void Qcommon_Init (int argc, char **argv); void Qcommon_Init (int argc, char **argv);
bool useScreenLayer() qboolean useScreenLayer()
{ {
//TODO //TODO
return (showingScreenLayer || (cls.state != ca_connected && cls.state != ca_active) || cls.key_dest != key_game) || cl.cinematictime != 0; return qtrue;//(showingScreenLayer || (cls.state != ca_connected && cls.state != ca_active) || cls.key_dest != key_game) || cl.cinematictime != 0;
} }
int runStatus = -1; int runStatus = -1;
void Q2VR_exit(int exitCode) void RTCWVR_exit(int exitCode)
{ {
runStatus = exitCode; runStatus = exitCode;
} }
@ -1374,9 +1372,6 @@ void VR_Init()
vr_worldscale = Cvar_Get( "vr_worldscale", "26.2467", CVAR_ARCHIVE); vr_worldscale = Cvar_Get( "vr_worldscale", "26.2467", CVAR_ARCHIVE);
} }
/* Called before SDL_main() to initialize JNI bindings in SDL library */
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
void FS_AddDirToSearchPath(char *dir, qboolean create);
void * AppThreadFunction( void * parm ) void * AppThreadFunction( void * parm )
{ {
@ -1389,15 +1384,10 @@ void * AppThreadFunction( void * parm )
jclass cls = (*java.Env)->GetObjectClass(java.Env, java.ActivityObject); jclass cls = (*java.Env)->GetObjectClass(java.Env, java.ActivityObject);
/* This interface could expand with ABI negotiation, callbacks, etc. */
SDL_Android_Init(java.Env, cls);
SDL_SetMainReady();
// Note that AttachCurrentThread will reset the thread name. // Note that AttachCurrentThread will reset the thread name.
prctl( PR_SET_NAME, (long)"OVR::Main", 0, 0, 0 ); prctl( PR_SET_NAME, (long)"OVR::Main", 0, 0, 0 );
quake2_initialised = false; rtcw_initialised = qfalse;
const ovrInitParms initParms = vrapi_DefaultInitParms( &java ); const ovrInitParms initParms = vrapi_DefaultInitParms( &java );
int32_t initResult = vrapi_Initialize( &initParms ); int32_t initResult = vrapi_Initialize( &initParms );
@ -1450,25 +1440,25 @@ void * AppThreadFunction( void * parm )
} }
case MESSAGE_ON_START: case MESSAGE_ON_START:
{ {
if (!quake2_initialised) if (!rtcw_initialised)
{ {
ALOGV( " Initialising Quake2 Engine" ); ALOGV( " Initialising RTCW Engine" );
if (argc != 0) if (argc != 0)
{ {
//TODO //TODO
Qcommon_Init(argc, (const char**)argv); RTCW_Init(argc, (const char**)argv);
} }
else else
{ {
int argc = 1; char *argv[] = { "quake2" }; int argc = 1; char *argv[] = { "rtcw" };
Qcommon_Init(argc, (const char**)argv); RTCW_Init(argc, (const char**)argv);
} }
FS_AddDirToSearchPath("/sdcard/Quake2Quest", true); FS_AddDirToSearchPath("/sdcard/RTCWQuest", true);
quake2_initialised = true; rtcw_initialised = true;
} }
break; break;
} }
@ -1523,7 +1513,7 @@ void * AppThreadFunction( void * parm )
// Create the scene if not yet created. // Create the scene if not yet created.
// The scene is created here to be able to show a loading icon. // The scene is created here to be able to show a loading icon.
if (!quake2_initialised || runStatus != -1) if (!rtcw_initialised || runStatus != -1)
{ {
// Show a loading icon. // Show a loading icon.
int frameFlags = 0; int frameFlags = 0;
@ -1801,8 +1791,6 @@ Activity lifecycle
================================================================================ ================================================================================
*/ */
JNIEXPORT jint JNICALL SDL_JNI_OnLoad(JavaVM* vm, void* reserved);
int JNI_OnLoad(JavaVM* vm, void* reserved) int JNI_OnLoad(JavaVM* vm, void* reserved)
{ {
JNIEnv *env; JNIEnv *env;
@ -1812,10 +1800,11 @@ int JNI_OnLoad(JavaVM* vm, void* reserved)
return -1; return -1;
} }
return SDL_JNI_OnLoad(vm, reserved); //1 correct??!
return 1;//SDL_JNI_OnLoad(vm, reserved);
} }
JNIEXPORT jlong JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onCreate( JNIEnv * env, jclass activityClass, jobject activity, JNIEXPORT jlong JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onCreate( JNIEnv * env, jclass activityClass, jobject activity,
jstring commandLineParams) jstring commandLineParams)
{ {
ALOGV( " GLES3JNILib::onCreate()" ); ALOGV( " GLES3JNILib::onCreate()" );
@ -1878,7 +1867,7 @@ JNIEXPORT jlong JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onCreate( JNIEnv
} }
JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onStart( JNIEnv * env, jobject obj, jlong handle) JNIEXPORT void JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onStart( JNIEnv * env, jobject obj, jlong handle)
{ {
ALOGV( " GLES3JNILib::onStart()" ); ALOGV( " GLES3JNILib::onStart()" );
@ -1888,7 +1877,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onStart( JNIEnv *
ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message ); ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message );
} }
JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onResume( JNIEnv * env, jobject obj, jlong handle ) JNIEXPORT void JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onResume( JNIEnv * env, jobject obj, jlong handle )
{ {
ALOGV( " GLES3JNILib::onResume()" ); ALOGV( " GLES3JNILib::onResume()" );
ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle);
@ -1897,7 +1886,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onResume( JNIEnv
ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message ); ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message );
} }
JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onPause( JNIEnv * env, jobject obj, jlong handle ) JNIEXPORT void JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onPause( JNIEnv * env, jobject obj, jlong handle )
{ {
ALOGV( " GLES3JNILib::onPause()" ); ALOGV( " GLES3JNILib::onPause()" );
ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle);
@ -1906,7 +1895,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onPause( JNIEnv *
ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message ); ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message );
} }
JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onStop( JNIEnv * env, jobject obj, jlong handle ) JNIEXPORT void JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onStop( JNIEnv * env, jobject obj, jlong handle )
{ {
ALOGV( " GLES3JNILib::onStop()" ); ALOGV( " GLES3JNILib::onStop()" );
ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle);
@ -1915,7 +1904,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onStop( JNIEnv *
ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message ); ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message );
} }
JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onDestroy( JNIEnv * env, jobject obj, jlong handle ) JNIEXPORT void JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onDestroy( JNIEnv * env, jobject obj, jlong handle )
{ {
ALOGV( " GLES3JNILib::onDestroy()" ); ALOGV( " GLES3JNILib::onDestroy()" );
ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle);
@ -1936,7 +1925,7 @@ Surface lifecycle
================================================================================ ================================================================================
*/ */
JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onSurfaceCreated( JNIEnv * env, jobject obj, jlong handle, jobject surface ) JNIEXPORT void JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onSurfaceCreated( JNIEnv * env, jobject obj, jlong handle, jobject surface )
{ {
ALOGV( " GLES3JNILib::onSurfaceCreated()" ); ALOGV( " GLES3JNILib::onSurfaceCreated()" );
ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle);
@ -1959,7 +1948,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onSurfaceCreated(
ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message ); ovrMessageQueue_PostMessage( &appThread->MessageQueue, &message );
} }
JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onSurfaceChanged( JNIEnv * env, jobject obj, jlong handle, jobject surface ) JNIEXPORT void JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onSurfaceChanged( JNIEnv * env, jobject obj, jlong handle, jobject surface )
{ {
ALOGV( " GLES3JNILib::onSurfaceChanged()" ); ALOGV( " GLES3JNILib::onSurfaceChanged()" );
ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle);
@ -2001,7 +1990,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onSurfaceChanged(
} }
} }
JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onSurfaceDestroyed( JNIEnv * env, jobject obj, jlong handle ) JNIEXPORT void JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onSurfaceDestroyed( JNIEnv * env, jobject obj, jlong handle )
{ {
ALOGV( " GLES3JNILib::onSurfaceDestroyed()" ); ALOGV( " GLES3JNILib::onSurfaceDestroyed()" );
ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle);

View file

@ -1,14 +1,13 @@
#if !defined(vrcommon_h) #if !defined(vrcommon_h)
#define vrcommon_h #define vrcommon_h
#include <VrApi_Ext.h>
#include <VrApi_Input.h> #include <VrApi_Input.h>
#include <android/log.h> #include <android/log.h>
#include "mathlib.h" #include "mathlib.h"
#define LOG_TAG "Quake2VR" #define LOG_TAG "RTCWVR"
#ifndef NDEBUG #ifndef NDEBUG
#define DEBUG 1 #define DEBUG 1
@ -22,14 +21,14 @@
#define ALOGV(...) #define ALOGV(...)
#endif #endif
bool quake2_initialised; qboolean rtcw_initialised;
long long global_time; long long global_time;
float playerHeight; float playerHeight;
float playerYaw; float playerYaw;
bool showingScreenLayer; qboolean showingScreenLayer;
float vrFOV; float vrFOV;
vec3_t worldPosition; vec3_t worldPosition;
@ -49,7 +48,7 @@ vec3_t flashlightoffset;
#define DUCK_CROUCHED 2 #define DUCK_CROUCHED 2
int ducked; int ducked;
bool player_moving; qboolean player_moving;
float radians(float deg); float radians(float deg);
@ -58,10 +57,10 @@ qboolean isMultiplayer();
double GetTimeInMilliSeconds(); double GetTimeInMilliSeconds();
float length(float x, float y); float length(float x, float y);
float nonLinearFilter(float in); float nonLinearFilter(float in);
bool between(float min, float val, float max); qboolean between(float min, float val, float max);
void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out); void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out);
void QuatToYawPitchRoll(ovrQuatf q, float pitchAdjust, vec3_t out); void QuatToYawPitchRoll(ovrQuatf q, float pitchAdjust, vec3_t out);
bool useScreenLayer(); qboolean useScreenLayer();
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key); void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key);
#endif //vrcommon_h #endif //vrcommon_h

View file

@ -86,10 +86,10 @@ void sendButtonActionSimple(const char* action)
{ {
char command[256]; char command[256];
snprintf( command, sizeof( command ), "%s\n", action ); snprintf( command, sizeof( command ), "%s\n", action );
Cbuf_AddText( command ); // Cbuf_AddText( command );
} }
bool between(float min, float val, float max) qboolean between(float min, float val, float max)
{ {
return (min < val) && (val < max); return (min < val) && (val < max);
} }
@ -102,7 +102,7 @@ void sendButtonAction(const char* action, long buttonDown)
{ {
command[0] = '-'; command[0] = '-';
} }
Cbuf_AddText( command ); // Cbuf_AddText( command );
} }
void acquireTrackedRemotesData(const ovrMobile *Ovr, double displayTime) {//The amount of yaw changed by controller void acquireTrackedRemotesData(const ovrMobile *Ovr, double displayTime) {//The amount of yaw changed by controller

View file

@ -16,7 +16,7 @@ Authors : Simon Brown
#include "VrInput.h" #include "VrInput.h"
#include "VrCvars.h" #include "VrCvars.h"
#include "../quake2/src/client/header/client.h" #include "../rtcw/src/client/client.h"
extern cvar_t *cl_forwardspeed; extern cvar_t *cl_forwardspeed;
cvar_t *sv_cheats; cvar_t *sv_cheats;
@ -54,7 +54,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Menu button //Menu button
handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, K_ESCAPE); handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, K_ESCAPE);
if (cls.key_dest == key_menu) /* if (cls.key_dest == key_menu)
{ {
int leftJoyState = (pOffTrackedRemoteNew->Joystick.x > 0.7f ? 1 : 0); int leftJoyState = (pOffTrackedRemoteNew->Joystick.x > 0.7f ? 1 : 0);
if (leftJoyState != (pOffTrackedRemoteOld->Joystick.x > 0.7f ? 1 : 0)) { if (leftJoyState != (pOffTrackedRemoteOld->Joystick.x > 0.7f ? 1 : 0)) {
@ -77,7 +77,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, ovrButton_Trigger, K_ENTER); handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, ovrButton_Trigger, K_ENTER);
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton2, K_ESCAPE); handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton2, K_ESCAPE);
} }
else else */
{ {
float distance = sqrtf(powf(pOffTracking->HeadPose.Pose.Position.x - pDominantTracking->HeadPose.Pose.Position.x, 2) + float distance = sqrtf(powf(pOffTracking->HeadPose.Pose.Position.x - pDominantTracking->HeadPose.Pose.Position.x, 2) +
powf(pOffTracking->HeadPose.Pose.Position.y - pDominantTracking->HeadPose.Pose.Position.y, 2) + powf(pOffTracking->HeadPose.Pose.Position.y - pDominantTracking->HeadPose.Pose.Position.y, 2) +
@ -91,12 +91,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
{ {
if (distance < 0.50f) if (distance < 0.50f)
{ {
Cvar_ForceSet("vr_weapon_stabilised", "1.0"); // Cvar_ForceSet("vr_weapon_stabilised", "1.0");
} }
} }
else else
{ {
Cvar_ForceSet("vr_weapon_stabilised", "0.0"); // Cvar_ForceSet("vr_weapon_stabilised", "0.0");
} }
} }
@ -109,7 +109,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
{ {
vec2_t v; vec2_t v;
rotateAboutOrigin(-weaponoffset[0], weaponoffset[2], (cl.refdef.viewangles[YAW] - hmdorientation[YAW]), v); rotateAboutOrigin(-weaponoffset[0], weaponoffset[2], (cl.viewangles[YAW] - hmdorientation[YAW]), v);
weaponoffset[0] = v[0]; weaponoffset[0] = v[0];
weaponoffset[2] = v[1]; weaponoffset[2] = v[1];
} }
@ -117,7 +117,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick //Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
const ovrQuatf quatRemote = pDominantTracking->HeadPose.Pose.Orientation; const ovrQuatf quatRemote = pDominantTracking->HeadPose.Pose.Orientation;
QuatToYawPitchRoll(quatRemote, vr_weapon_pitchadjust->value, weaponangles); QuatToYawPitchRoll(quatRemote, vr_weapon_pitchadjust->value, weaponangles);
weaponangles[YAW] += (cl.refdef.viewangles[YAW] - hmdorientation[YAW]); weaponangles[YAW] += (cl.viewangles[YAW] - hmdorientation[YAW]);
weaponangles[ROLL] *= -1.0f; weaponangles[ROLL] *= -1.0f;
@ -129,7 +129,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
float zxDist = length(x, z); float zxDist = length(x, z);
if (zxDist != 0.0f && z != 0.0f) { if (zxDist != 0.0f && z != 0.0f) {
VectorSet(weaponangles, -degrees(atanf(y / zxDist)), (cl.refdef.viewangles[YAW] - hmdorientation[YAW]) - degrees(atan2f(x, -z)), weaponangles[ROLL]); VectorSet(weaponangles, -degrees(atanf(y / zxDist)), (cl.viewangles[YAW] - hmdorientation[YAW]) - degrees(atan2f(x, -z)), weaponangles[ROLL]);
} }
} }
@ -149,16 +149,16 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
flashlightoffset[2] = pOffTracking->HeadPose.Pose.Position.z - hmdPosition[2]; flashlightoffset[2] = pOffTracking->HeadPose.Pose.Position.z - hmdPosition[2];
vec2_t v; vec2_t v;
rotateAboutOrigin(-flashlightoffset[0], flashlightoffset[2], (cl.refdef.viewangles[YAW] - hmdorientation[YAW]), v); rotateAboutOrigin(-flashlightoffset[0], flashlightoffset[2], (cl.viewangles[YAW] - hmdorientation[YAW]), v);
flashlightoffset[0] = v[0]; flashlightoffset[0] = v[0];
flashlightoffset[2] = v[1]; flashlightoffset[2] = v[1];
QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, 15.0f, flashlightangles); QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, 15.0f, flashlightangles);
flashlightangles[YAW] += (cl.refdef.viewangles[YAW] - hmdorientation[YAW]); flashlightangles[YAW] += (cl.viewangles[YAW] - hmdorientation[YAW]);
if (vr_walkdirection->value == 0) { if (vr_walkdirection->value == 0) {
controllerYawHeading = -cl.refdef.viewangles[YAW] + flashlightangles[YAW]; controllerYawHeading = -cl.viewangles[YAW] + flashlightangles[YAW];
} }
else else
{ {
@ -180,7 +180,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
vec2_t v; vec2_t v;
rotateAboutOrigin(-positionDeltaThisFrame[0] * multiplier, rotateAboutOrigin(-positionDeltaThisFrame[0] * multiplier,
positionDeltaThisFrame[2] * multiplier, /*cl.refdef.viewangles[YAW]*/ - hmdorientation[YAW], v); positionDeltaThisFrame[2] * multiplier, /*cl.viewangles[YAW]*/ - hmdorientation[YAW], v);
positional_movementSideways = v[0]; positional_movementSideways = v[0];
positional_movementForward = v[1]; positional_movementForward = v[1];
@ -274,9 +274,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
if (vr_lasersight->value != 0.0) if (vr_lasersight->value != 0.0)
{ {
Cvar_ForceSet("vr_lasersight", "0.0"); // Cvar_ForceSet("vr_lasersight", "0.0");
} else { } else {
Cvar_ForceSet("vr_lasersight", "1.0"); // Cvar_ForceSet("vr_lasersight", "1.0");
} }
} }

View file

@ -396,10 +396,10 @@ BoundsIntersect
qboolean BoundsIntersect( const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2 ) qboolean BoundsIntersect( const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2 )
{ {
if( mins1[0] > maxs2[0] || mins1[1] > maxs2[1] || mins1[2] > maxs2[2] ) if( mins1[0] > maxs2[0] || mins1[1] > maxs2[1] || mins1[2] > maxs2[2] )
return false; return qfalse;
if( maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2] ) if( maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2] )
return false; return qfalse;
return true; return qtrue;
} }
/* /*
@ -410,10 +410,10 @@ BoundsAndSphereIntersect
qboolean BoundsAndSphereIntersect( const vec3_t mins, const vec3_t maxs, const vec3_t origin, float radius ) qboolean BoundsAndSphereIntersect( const vec3_t mins, const vec3_t maxs, const vec3_t origin, float radius )
{ {
if( mins[0] > origin[0] + radius || mins[1] > origin[1] + radius || mins[2] > origin[2] + radius ) if( mins[0] > origin[0] + radius || mins[1] > origin[1] + radius || mins[2] > origin[2] + radius )
return false; return qfalse;
if( maxs[0] < origin[0] - radius || maxs[1] < origin[1] - radius || maxs[2] < origin[2] - radius ) if( maxs[0] < origin[0] - radius || maxs[1] < origin[1] - radius || maxs[2] < origin[2] - radius )
return false; return qfalse;
return true; return qtrue;
} }

View file

@ -18,9 +18,9 @@ GNU General Public License for more details.
#include <math.h> #include <math.h>
#include "../quake2/src/common/header/common.h" //#include "../rtcw/src/common/header/common.h"
#include "../quake2/src/client/header/keyboard.h" //#include "../rtcw/src/client/header/keyboard.h"
#include "../rtcw/src//game/q_shared.h"
// euler angle order // euler angle order
#define PITCH 0 #define PITCH 0

View file

@ -843,10 +843,10 @@ qboolean Matrix4x4_Invert_Full( matrix4x4 out, cmatrix4x4 in1 )
out[3][2] = r[3][6]; out[3][2] = r[3][6];
out[3][3] = r[3][7]; out[3][3] = r[3][7];
return true; return qtrue;
} }
} }
} }
} }
return false; return qfalse;
} }

View file

@ -74,7 +74,7 @@ LOCAL_SRC_FILES := \
src/glx/gbm.c \ src/glx/gbm.c \
src/glx/streaming.c \ src/glx/streaming.c \
LOCAL_CFLAGS += -g -std=c99 -funwind-tables -O3 -DBCMHOST -fvisibility=hidden -include include/android_debug.h LOCAL_CFLAGS += -g -funwind-tables -O3 -DBCMHOST -fvisibility=hidden -include include/android_debug.h
LOCAL_CFLAGS += -DNOX11 LOCAL_CFLAGS += -DNOX11
LOCAL_CFLAGS += -DNO_GBM LOCAL_CFLAGS += -DNO_GBM
LOCAL_CFLAGS += -DDEFAULT_ES=2 LOCAL_CFLAGS += -DDEFAULT_ES=2

View file

@ -1,6 +1,6 @@
#include "buffers.h" #include "buffers.h"
#include "khash.h" #include <include/khash.h>
#include "../glx/hardext.h" #include "../glx/hardext.h"
#include "attributes.h" #include "attributes.h"
#include "debug.h" #include "debug.h"

View file

@ -1,7 +1,7 @@
#ifndef _GL4ES_BUFFERS_H_ #ifndef _GL4ES_BUFFERS_H_
#define _GL4ES_BUFFERS_H_ #define _GL4ES_BUFFERS_H_
#include "khash.h" #include <include/khash.h>
#include "../config.h" #include "../config.h"
#include "gles.h" #include "gles.h"

View file

@ -1,7 +1,7 @@
#ifndef _GL4ES_GL4ES_H_ #ifndef _GL4ES_GL4ES_H_
#define _GL4ES_GL4ES_H_ #define _GL4ES_GL4ES_H_
#include "khash.h" #include <include/khash.h>
#ifdef __ARM_NEON__ #ifdef __ARM_NEON__
#include <arm_neon.h> #include <arm_neon.h>

View file

@ -2,7 +2,7 @@
#define _GL4ES_LIST_H_ #define _GL4ES_LIST_H_
#include <stdbool.h> #include <stdbool.h>
#include "khash.h" #include <include/khash.h>
#include "../config.h" #include "../config.h"
#include "wrap/gles.h" #include "wrap/gles.h"
#include "attributes.h" #include "attributes.h"

View file

@ -2,7 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include "khash.h" #include <include/khash.h>
#include "preproc.h" #include "preproc.h"
#include "string_utils.h" #include "string_utils.h"

View file

@ -1,6 +1,6 @@
#include "queries.h" #include "queries.h"
#include "khash.h" #include <include/khash.h>
#include "gl4es.h" #include "gl4es.h"
#include "glstate.h" #include "glstate.h"
#include "loader.h" #include "loader.h"

View file

@ -1,7 +1,7 @@
#ifndef _GL4ES_QUERIES_H_ #ifndef _GL4ES_QUERIES_H_
#define _GL4ES_QUERIES_H_ #define _GL4ES_QUERIES_H_
#include "khash.h" #include <include/khash.h>
#include "gles.h" #include "gles.h"
void gl4es_glBeginQuery(GLenum target, GLuint id); void gl4es_glBeginQuery(GLenum target, GLuint id);

View file

@ -1,7 +1,7 @@
#ifndef _GL4ES_SHADER_H_ #ifndef _GL4ES_SHADER_H_
#define _GL4ES_SHADER_H_ #define _GL4ES_SHADER_H_
#include "khash.h" #include <include/khash.h>
#include "gles.h" #include "gles.h"
typedef struct { typedef struct {

View file

@ -1,7 +1,7 @@
#ifndef _GL4ES_STATE_H_ #ifndef _GL4ES_STATE_H_
#define _GL4ES_STATE_H_ #define _GL4ES_STATE_H_
#include "khash.h" #include <include/khash.h>
#include "buffers.h" #include "buffers.h"
#include "eval.h" #include "eval.h"
#include "gles.h" #include "gles.h"

View file

@ -5,7 +5,7 @@
#include <execinfo.h> #include <execinfo.h>
#endif // !defined(ANDROID) && !defined(AMIGAOS4) #endif // !defined(ANDROID) && !defined(AMIGAOS4)
#include <fcntl.h> #include <fcntl.h>
#include "khash.h" #include <include/khash.h>
#ifdef USE_FBIO #ifdef USE_FBIO
#include <linux/fb.h> #include <linux/fb.h>
#endif // USE_FBIO #endif // USE_FBIO

View file

@ -12,12 +12,14 @@ LOCAL_CFLAGS = $(RTCW_BASE_CFLAGS) -DBOTLIB
LOCAL_LDFLAGS = $(RTCW_BASE_LDFLAGS) LOCAL_LDFLAGS = $(RTCW_BASE_LDFLAGS)
LOCAL_C_INCLUDES = $(LOCAL_PATH) LOCAL_C_INCLUDES = $(LOCAL_PATH) \
$(GL4ES_PATH) \
$(GL4ES_PATH)/include
ANDROID_SRC = \ ANDROID_SRC = \
code/android/android-jni.cpp \ # code/android/android-jni.cpp \
code/android/in_android.c \ # code/android/in_android.c \
code/android/ifaddrs.c \ code/android/ifaddrs.c \
SPLINES_FILES = \ SPLINES_FILES = \
@ -182,32 +184,41 @@ SERVER_FILES = \
src/qcommon/vm_none.c \ src/qcommon/vm_none.c \
UNIX_FILES = \ UNIX_FILES = \
src/android/android_main.c \ # src/android/android_main.c \
src/unix/unix_net.c \ src/unix/unix_net.c \
src/unix/unix_shared.c \ src/unix/unix_shared.c \
src/unix/linux_common.c\ src/unix/linux_common.c\
src/unix/linux_qgl.c \ src/unix/linux_qgl.c \
src/android/android_glimp.c \ src/android/android_glimp.c \
src/android/android_snd.c \ src/android/android_snd.c \
src/android/android-jni.cpp \ # src/android/android-jni.cpp \
src/android/in_android.c \ # src/android/in_android.c \
src/game/q_shared.c \ src/game/q_shared.c \
src/game/q_math.c src/game/q_math.c
#src/unix/linux_joystick.c \
RTCWVR_SRC_FILES := ../RTCWVR/RTCWVR_SurfaceView.c \
../RTCWVR/VrCompositor.c \
../RTCWVR/VrInputCommon.c \
../RTCWVR/VrInputDefault.c \
../RTCWVR/mathlib.c \
../RTCWVR/matrixlib.c \
../RTCWVR/argtable3.c
LOCAL_SRC_FILES = $(UNIX_FILES) $(RENDERER_FILES) $(SPLINES_FILES) $(BOTLIB_FILES) $(JPEGLIB_FILES) $(CLIENT_FILES) $(COMMON_FILES) $(SOUND_FILES) $(SERVER_FILES) $(VM_FILES) LOCAL_SRC_FILES = $(UNIX_FILES) $(RENDERER_FILES) $(SPLINES_FILES) $(BOTLIB_FILES) $(JPEGLIB_FILES) $(CLIENT_FILES) $(COMMON_FILES) $(SOUND_FILES) $(SERVER_FILES) $(VM_FILES) $(RTCWVR_SRC_FILES)
LOCAL_LDLIBS := -lGLESv3 -lEGL -ldl -llog -lOpenSLES -lz -lm LOCAL_LDLIBS := -lGLESv3 -lEGL -ldl -llog -lOpenSLES -lz -lm
LOCAL_LDLIBS += -fuse-ld=bfd LOCAL_LDLIBS += -fuse-ld=bfd
LOCAL_STATIC_LIBRARIES := libjpeg libpng LOCAL_STATIC_LIBRARIES := libjpeg libpng
LOCAL_SHARED_LIBRARIES := touchcontrols LOCAL_SHARED_LIBRARIES := vrapi qagamearm gl4es cgamearm uiarm
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
$(call import-module,VrApi/Projects/AndroidPrebuilt/jni)

View file

@ -21,8 +21,8 @@
#include <jni.h> #include <jni.h>
#include <android/log.h> #include <android/log.h>
#include "TouchControlsContainer.h" //#include "TouchControlsContainer.h"
#include "JNITouchControlsUtils.h" //#include "JNITouchControlsUtils.h"
extern "C" extern "C"
{ {

View file

@ -1,4 +1,4 @@
#include "beloko_common/port_act_defs.h" //#include "beloko_common/port_act_defs.h"

View file

@ -1164,7 +1164,7 @@ int CL_UISystemCalls( int *args ) {
// -NERVE - SMF // -NERVE - SMF
case UI_CIN_SHOWSOFTKEYBOARD: case UI_CIN_SHOWSOFTKEYBOARD:
showKeyboard(args[1]); showKeyboard(args[1]);
return; return 0;
default: default:
Com_Error( ERR_DROP, "Bad UI system trap: %i", args[0] ); Com_Error( ERR_DROP, "Bad UI system trap: %i", args[0] );

View file

@ -1,4 +1,4 @@
rootProject.projectDir = new File(settingsDir, '../../../..') rootProject.projectDir = new File(settingsDir, '../../../..')
rootProject.name = "Quake2Quest" rootProject.name = "RTCWQuest"
include ':', 'VrSamples:Quake2Quest:Projects:Android' include ':', 'VrSamples:RTCWQuest:Projects:Android'

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":VrSamples:Quake2Quest" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/Projects/Android" external.system.id="GRADLE" type="JAVA_MODULE" version="4"> <module external.linked.project.id=":VrSamples:RTCWQuest" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/Projects/Android" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle"> <facet type="android-gradle" name="Android-Gradle">
<configuration> <configuration>
<option name="GRADLE_PROJECT_PATH" value=":VrSamples:Quake2Quest" /> <option name="GRADLE_PROJECT_PATH" value=":VrSamples:RTCWQuest" />
</configuration> </configuration>
</facet> </facet>
<facet type="java-gradle" name="Java-Gradle"> <facet type="java-gradle" name="Java-Gradle">

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -5,6 +5,6 @@
<resources> <resources>
<!-- Simple strings. --> <!-- Simple strings. -->
<string name="quake2quest">Quake2Quest</string> <string name="rtcwquest">RTCWQuest</string>
</resources> </resources>