From 15880317b43e1f0dc599afcece46414330c0407d Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 28 Jun 2020 14:41:34 +0100 Subject: [PATCH] Getting it building... ..but not there yet --- Projects/Android/AndroidManifest.xml | 14 ++-- Projects/Android/build.gradle | 2 +- .../Android/jni/RTCWVR/RTCWVR_SurfaceView.c | 65 ++++++++---------- Projects/Android/jni/RTCWVR/VrCommon.h | 13 ++-- Projects/Android/jni/RTCWVR/VrInputCommon.c | 6 +- Projects/Android/jni/RTCWVR/VrInputDefault.c | 28 ++++---- Projects/Android/jni/RTCWVR/mathlib.c | 12 ++-- Projects/Android/jni/RTCWVR/mathlib.h | 6 +- Projects/Android/jni/RTCWVR/matrixlib.c | 4 +- .../Android/jni/SupportLibs/gl4es/Android.mk | 2 +- .../jni/SupportLibs/gl4es/src/gl/buffers.c | 2 +- .../jni/SupportLibs/gl4es/src/gl/buffers.h | 2 +- .../jni/SupportLibs/gl4es/src/gl/gl4es.h | 2 +- .../jni/SupportLibs/gl4es/src/gl/list.h | 2 +- .../jni/SupportLibs/gl4es/src/gl/preproc.c | 2 +- .../jni/SupportLibs/gl4es/src/gl/queries.c | 2 +- .../jni/SupportLibs/gl4es/src/gl/queries.h | 2 +- .../jni/SupportLibs/gl4es/src/gl/shader.h | 2 +- .../jni/SupportLibs/gl4es/src/gl/state.h | 2 +- .../jni/SupportLibs/gl4es/src/glx/glx.c | 2 +- Projects/Android/jni/rtcw/Android_client.mk | 29 +++++--- .../jni/rtcw/src/android/android-jni.cpp | 4 +- .../Android/jni/rtcw/src/android/in_android.h | 2 +- Projects/Android/jni/rtcw/src/client/cl_ui.c | 2 +- Projects/Android/settings.gradle | 4 +- VrSamples-RTCWQuest.iml | 4 +- .../{ic_qquest.png => ic_rtcwquest.png} | Bin .../{ic_qquest.png => ic_rtcwquest.png} | Bin .../{ic_qquest.png => ic_rtcwquest.png} | Bin .../{ic_qquest.png => ic_rtcwquest.png} | Bin res/values/strings.xml | 2 +- 31 files changed, 109 insertions(+), 110 deletions(-) rename res/drawable-hdpi/{ic_qquest.png => ic_rtcwquest.png} (100%) rename res/drawable-mdpi/{ic_qquest.png => ic_rtcwquest.png} (100%) rename res/drawable-xhdpi/{ic_qquest.png => ic_rtcwquest.png} (100%) rename res/drawable-xxhdpi/{ic_qquest.png => ic_rtcwquest.png} (100%) diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 5b7f173..f6b2225 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + package="com.drbeef.rtcwquest" + android:versionCode="1" + android:versionName="0.1.0" android:installLocation="auto" > @@ -16,7 +16,7 @@ - + @@ -24,15 +24,15 @@ - + diff --git a/Projects/Android/build.gradle b/Projects/Android/build.gradle index 6b1b697..75c4eb8 100644 --- a/Projects/Android/build.gradle +++ b/Projects/Android/build.gradle @@ -6,7 +6,7 @@ android { // -debug.apk or -release.apk appended to it. // The filename doesn't effect the Android installation process. // Use only letters to remain compatible with the package name. - project.archivesBaseName = "quake2quest" + project.archivesBaseName = "rtcwquest" defaultConfig { // Gradle replaces the manifest package with this value, which must diff --git a/Projects/Android/jni/RTCWVR/RTCWVR_SurfaceView.c b/Projects/Android/jni/RTCWVR/RTCWVR_SurfaceView.c index c863162..8123c9f 100644 --- a/Projects/Android/jni/RTCWVR/RTCWVR_SurfaceView.c +++ b/Projects/Android/jni/RTCWVR/RTCWVR_SurfaceView.c @@ -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 Activity and Surface life cycle events in native code. This sample 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 -#include -#include -#include +//#include +//#include +#include #include "VrCompositor.h" #include "VrInput.h" -#include "../quake2/src/client/header/client.h" - #if !defined( EGL_OPENGL_ES3_BIT_KHR ) #define EGL_OPENGL_ES3_BIT_KHR 0x0040 #endif @@ -137,14 +135,14 @@ LAMBDA1VR Stuff void Qcommon_Init (int argc, char **argv); -bool useScreenLayer() +qboolean useScreenLayer() { //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; -void Q2VR_exit(int exitCode) +void RTCWVR_exit(int exitCode) { runStatus = exitCode; } @@ -1374,9 +1372,6 @@ void VR_Init() 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 ) { @@ -1389,15 +1384,10 @@ void * AppThreadFunction( void * parm ) 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. prctl( PR_SET_NAME, (long)"OVR::Main", 0, 0, 0 ); - quake2_initialised = false; + rtcw_initialised = qfalse; const ovrInitParms initParms = vrapi_DefaultInitParms( &java ); int32_t initResult = vrapi_Initialize( &initParms ); @@ -1450,25 +1440,25 @@ void * AppThreadFunction( void * parm ) } case MESSAGE_ON_START: { - if (!quake2_initialised) + if (!rtcw_initialised) { - ALOGV( " Initialising Quake2 Engine" ); + ALOGV( " Initialising RTCW Engine" ); if (argc != 0) { //TODO - Qcommon_Init(argc, (const char**)argv); + RTCW_Init(argc, (const char**)argv); } 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; } @@ -1523,7 +1513,7 @@ void * AppThreadFunction( void * parm ) // Create the scene if not yet created. // 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. 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) { JNIEnv *env; @@ -1812,10 +1800,11 @@ int JNI_OnLoad(JavaVM* vm, void* reserved) 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) { 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()" ); @@ -1888,7 +1877,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onStart( JNIEnv * 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()" ); 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 ); } -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()" ); 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 ); } -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()" ); 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 ); } -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()" ); 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()" ); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); @@ -1959,7 +1948,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onSurfaceCreated( 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()" ); 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()" ); ovrAppThread * appThread = (ovrAppThread *)((size_t)handle); diff --git a/Projects/Android/jni/RTCWVR/VrCommon.h b/Projects/Android/jni/RTCWVR/VrCommon.h index 58d09d9..09d3590 100644 --- a/Projects/Android/jni/RTCWVR/VrCommon.h +++ b/Projects/Android/jni/RTCWVR/VrCommon.h @@ -1,14 +1,13 @@ #if !defined(vrcommon_h) #define vrcommon_h -#include #include #include #include "mathlib.h" -#define LOG_TAG "Quake2VR" +#define LOG_TAG "RTCWVR" #ifndef NDEBUG #define DEBUG 1 @@ -22,14 +21,14 @@ #define ALOGV(...) #endif -bool quake2_initialised; +qboolean rtcw_initialised; long long global_time; float playerHeight; float playerYaw; -bool showingScreenLayer; +qboolean showingScreenLayer; float vrFOV; vec3_t worldPosition; @@ -49,7 +48,7 @@ vec3_t flashlightoffset; #define DUCK_CROUCHED 2 int ducked; -bool player_moving; +qboolean player_moving; float radians(float deg); @@ -58,10 +57,10 @@ qboolean isMultiplayer(); double GetTimeInMilliSeconds(); float length(float x, float y); 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 QuatToYawPitchRoll(ovrQuatf q, float pitchAdjust, vec3_t out); -bool useScreenLayer(); +qboolean useScreenLayer(); void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key); #endif //vrcommon_h \ No newline at end of file diff --git a/Projects/Android/jni/RTCWVR/VrInputCommon.c b/Projects/Android/jni/RTCWVR/VrInputCommon.c index e73302b..11f9135 100644 --- a/Projects/Android/jni/RTCWVR/VrInputCommon.c +++ b/Projects/Android/jni/RTCWVR/VrInputCommon.c @@ -86,10 +86,10 @@ void sendButtonActionSimple(const char* action) { char command[256]; 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); } @@ -102,7 +102,7 @@ void sendButtonAction(const char* action, long buttonDown) { command[0] = '-'; } - Cbuf_AddText( command ); +// Cbuf_AddText( command ); } void acquireTrackedRemotesData(const ovrMobile *Ovr, double displayTime) {//The amount of yaw changed by controller diff --git a/Projects/Android/jni/RTCWVR/VrInputDefault.c b/Projects/Android/jni/RTCWVR/VrInputDefault.c index abff774..dd06686 100644 --- a/Projects/Android/jni/RTCWVR/VrInputDefault.c +++ b/Projects/Android/jni/RTCWVR/VrInputDefault.c @@ -16,7 +16,7 @@ Authors : Simon Brown #include "VrInput.h" #include "VrCvars.h" -#include "../quake2/src/client/header/client.h" +#include "../rtcw/src/client/client.h" extern cvar_t *cl_forwardspeed; cvar_t *sv_cheats; @@ -54,7 +54,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, //Menu button 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); 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, domButton2, K_ESCAPE); } - else + else */ { 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) + @@ -91,12 +91,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, { if (distance < 0.50f) { - Cvar_ForceSet("vr_weapon_stabilised", "1.0"); +// Cvar_ForceSet("vr_weapon_stabilised", "1.0"); } } 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; - 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[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 const ovrQuatf quatRemote = pDominantTracking->HeadPose.Pose.Orientation; 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; @@ -129,7 +129,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, float zxDist = length(x, z); 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]; 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[2] = v[1]; 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) { - controllerYawHeading = -cl.refdef.viewangles[YAW] + flashlightangles[YAW]; + controllerYawHeading = -cl.viewangles[YAW] + flashlightangles[YAW]; } else { @@ -180,7 +180,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, vec2_t v; 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_movementForward = v[1]; @@ -274,9 +274,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, if (vr_lasersight->value != 0.0) { - Cvar_ForceSet("vr_lasersight", "0.0"); +// Cvar_ForceSet("vr_lasersight", "0.0"); } else { - Cvar_ForceSet("vr_lasersight", "1.0"); +// Cvar_ForceSet("vr_lasersight", "1.0"); } } diff --git a/Projects/Android/jni/RTCWVR/mathlib.c b/Projects/Android/jni/RTCWVR/mathlib.c index 6f6d1a7..54c82f8 100644 --- a/Projects/Android/jni/RTCWVR/mathlib.c +++ b/Projects/Android/jni/RTCWVR/mathlib.c @@ -396,10 +396,10 @@ BoundsIntersect 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] ) - return false; + return qfalse; if( maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2] ) - return false; - return true; + return qfalse; + return qtrue; } /* @@ -410,10 +410,10 @@ BoundsAndSphereIntersect 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 ) - return false; + return qfalse; if( maxs[0] < origin[0] - radius || maxs[1] < origin[1] - radius || maxs[2] < origin[2] - radius ) - return false; - return true; + return qfalse; + return qtrue; } diff --git a/Projects/Android/jni/RTCWVR/mathlib.h b/Projects/Android/jni/RTCWVR/mathlib.h index 67431d2..4c664f2 100644 --- a/Projects/Android/jni/RTCWVR/mathlib.h +++ b/Projects/Android/jni/RTCWVR/mathlib.h @@ -18,9 +18,9 @@ GNU General Public License for more details. #include -#include "../quake2/src/common/header/common.h" -#include "../quake2/src/client/header/keyboard.h" - +//#include "../rtcw/src/common/header/common.h" +//#include "../rtcw/src/client/header/keyboard.h" +#include "../rtcw/src//game/q_shared.h" // euler angle order #define PITCH 0 diff --git a/Projects/Android/jni/RTCWVR/matrixlib.c b/Projects/Android/jni/RTCWVR/matrixlib.c index e7e9d90..3ec3517 100644 --- a/Projects/Android/jni/RTCWVR/matrixlib.c +++ b/Projects/Android/jni/RTCWVR/matrixlib.c @@ -843,10 +843,10 @@ qboolean Matrix4x4_Invert_Full( matrix4x4 out, cmatrix4x4 in1 ) out[3][2] = r[3][6]; out[3][3] = r[3][7]; - return true; + return qtrue; } } } } - return false; + return qfalse; } diff --git a/Projects/Android/jni/SupportLibs/gl4es/Android.mk b/Projects/Android/jni/SupportLibs/gl4es/Android.mk index 5433bae..5ddc943 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/Android.mk +++ b/Projects/Android/jni/SupportLibs/gl4es/Android.mk @@ -74,7 +74,7 @@ LOCAL_SRC_FILES := \ src/glx/gbm.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 += -DNO_GBM LOCAL_CFLAGS += -DDEFAULT_ES=2 diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/buffers.c b/Projects/Android/jni/SupportLibs/gl4es/src/gl/buffers.c index 5026070..db5876b 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/buffers.c +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/buffers.c @@ -1,6 +1,6 @@ #include "buffers.h" -#include "khash.h" +#include #include "../glx/hardext.h" #include "attributes.h" #include "debug.h" diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/buffers.h b/Projects/Android/jni/SupportLibs/gl4es/src/gl/buffers.h index ab1f196..26ee01b 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/buffers.h +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/buffers.h @@ -1,7 +1,7 @@ #ifndef _GL4ES_BUFFERS_H_ #define _GL4ES_BUFFERS_H_ -#include "khash.h" +#include #include "../config.h" #include "gles.h" diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/gl4es.h b/Projects/Android/jni/SupportLibs/gl4es/src/gl/gl4es.h index 42d16d2..34a7c50 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/gl4es.h +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/gl4es.h @@ -1,7 +1,7 @@ #ifndef _GL4ES_GL4ES_H_ #define _GL4ES_GL4ES_H_ -#include "khash.h" +#include #ifdef __ARM_NEON__ #include diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/list.h b/Projects/Android/jni/SupportLibs/gl4es/src/gl/list.h index f11208c..2246d83 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/list.h +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/list.h @@ -2,7 +2,7 @@ #define _GL4ES_LIST_H_ #include -#include "khash.h" +#include #include "../config.h" #include "wrap/gles.h" #include "attributes.h" diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/preproc.c b/Projects/Android/jni/SupportLibs/gl4es/src/gl/preproc.c index 7ba7576..c5ffc18 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/preproc.c +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/preproc.c @@ -2,7 +2,7 @@ #include #include #include -#include "khash.h" +#include #include "preproc.h" #include "string_utils.h" diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/queries.c b/Projects/Android/jni/SupportLibs/gl4es/src/gl/queries.c index 6f5665c..5086510 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/queries.c +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/queries.c @@ -1,6 +1,6 @@ #include "queries.h" -#include "khash.h" +#include #include "gl4es.h" #include "glstate.h" #include "loader.h" diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/queries.h b/Projects/Android/jni/SupportLibs/gl4es/src/gl/queries.h index b205aa7..2b5c4c8 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/queries.h +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/queries.h @@ -1,7 +1,7 @@ #ifndef _GL4ES_QUERIES_H_ #define _GL4ES_QUERIES_H_ -#include "khash.h" +#include #include "gles.h" void gl4es_glBeginQuery(GLenum target, GLuint id); diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/shader.h b/Projects/Android/jni/SupportLibs/gl4es/src/gl/shader.h index b4ac6ce..2bf02bc 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/shader.h +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/shader.h @@ -1,7 +1,7 @@ #ifndef _GL4ES_SHADER_H_ #define _GL4ES_SHADER_H_ -#include "khash.h" +#include #include "gles.h" typedef struct { diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/state.h b/Projects/Android/jni/SupportLibs/gl4es/src/gl/state.h index c06f69e..b14924b 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/state.h +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/state.h @@ -1,7 +1,7 @@ #ifndef _GL4ES_STATE_H_ #define _GL4ES_STATE_H_ -#include "khash.h" +#include #include "buffers.h" #include "eval.h" #include "gles.h" diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/glx/glx.c b/Projects/Android/jni/SupportLibs/gl4es/src/glx/glx.c index 5ea9d8a..7cea60b 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/glx/glx.c +++ b/Projects/Android/jni/SupportLibs/gl4es/src/glx/glx.c @@ -5,7 +5,7 @@ #include #endif // !defined(ANDROID) && !defined(AMIGAOS4) #include -#include "khash.h" +#include #ifdef USE_FBIO #include #endif // USE_FBIO diff --git a/Projects/Android/jni/rtcw/Android_client.mk b/Projects/Android/jni/rtcw/Android_client.mk index 02cde4e..5858f06 100644 --- a/Projects/Android/jni/rtcw/Android_client.mk +++ b/Projects/Android/jni/rtcw/Android_client.mk @@ -12,12 +12,14 @@ LOCAL_CFLAGS = $(RTCW_BASE_CFLAGS) -DBOTLIB LOCAL_LDFLAGS = $(RTCW_BASE_LDFLAGS) -LOCAL_C_INCLUDES = $(LOCAL_PATH) +LOCAL_C_INCLUDES = $(LOCAL_PATH) \ + $(GL4ES_PATH) \ + $(GL4ES_PATH)/include ANDROID_SRC = \ - code/android/android-jni.cpp \ - code/android/in_android.c \ + # code/android/android-jni.cpp \ + # code/android/in_android.c \ code/android/ifaddrs.c \ SPLINES_FILES = \ @@ -182,32 +184,41 @@ SERVER_FILES = \ src/qcommon/vm_none.c \ UNIX_FILES = \ - src/android/android_main.c \ + # src/android/android_main.c \ src/unix/unix_net.c \ src/unix/unix_shared.c \ src/unix/linux_common.c\ src/unix/linux_qgl.c \ src/android/android_glimp.c \ src/android/android_snd.c \ - src/android/android-jni.cpp \ - src/android/in_android.c \ + # src/android/android-jni.cpp \ + # src/android/in_android.c \ src/game/q_shared.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 += -fuse-ld=bfd LOCAL_STATIC_LIBRARIES := libjpeg libpng -LOCAL_SHARED_LIBRARIES := touchcontrols +LOCAL_SHARED_LIBRARIES := vrapi qagamearm gl4es cgamearm uiarm include $(BUILD_SHARED_LIBRARY) +$(call import-module,VrApi/Projects/AndroidPrebuilt/jni) diff --git a/Projects/Android/jni/rtcw/src/android/android-jni.cpp b/Projects/Android/jni/rtcw/src/android/android-jni.cpp index 56e44ab..1d04348 100644 --- a/Projects/Android/jni/rtcw/src/android/android-jni.cpp +++ b/Projects/Android/jni/rtcw/src/android/android-jni.cpp @@ -21,8 +21,8 @@ #include #include -#include "TouchControlsContainer.h" -#include "JNITouchControlsUtils.h" +//#include "TouchControlsContainer.h" +//#include "JNITouchControlsUtils.h" extern "C" { diff --git a/Projects/Android/jni/rtcw/src/android/in_android.h b/Projects/Android/jni/rtcw/src/android/in_android.h index 7884ebc..20dd4ad 100644 --- a/Projects/Android/jni/rtcw/src/android/in_android.h +++ b/Projects/Android/jni/rtcw/src/android/in_android.h @@ -1,4 +1,4 @@ -#include "beloko_common/port_act_defs.h" +//#include "beloko_common/port_act_defs.h" diff --git a/Projects/Android/jni/rtcw/src/client/cl_ui.c b/Projects/Android/jni/rtcw/src/client/cl_ui.c index 18d48ed..f97ebdb 100644 --- a/Projects/Android/jni/rtcw/src/client/cl_ui.c +++ b/Projects/Android/jni/rtcw/src/client/cl_ui.c @@ -1164,7 +1164,7 @@ int CL_UISystemCalls( int *args ) { // -NERVE - SMF case UI_CIN_SHOWSOFTKEYBOARD: showKeyboard(args[1]); - return; + return 0; default: Com_Error( ERR_DROP, "Bad UI system trap: %i", args[0] ); diff --git a/Projects/Android/settings.gradle b/Projects/Android/settings.gradle index 31a6295..56c5249 100644 --- a/Projects/Android/settings.gradle +++ b/Projects/Android/settings.gradle @@ -1,4 +1,4 @@ rootProject.projectDir = new File(settingsDir, '../../../..') -rootProject.name = "Quake2Quest" +rootProject.name = "RTCWQuest" -include ':', 'VrSamples:Quake2Quest:Projects:Android' +include ':', 'VrSamples:RTCWQuest:Projects:Android' diff --git a/VrSamples-RTCWQuest.iml b/VrSamples-RTCWQuest.iml index fb8ee18..fd80608 100644 --- a/VrSamples-RTCWQuest.iml +++ b/VrSamples-RTCWQuest.iml @@ -1,9 +1,9 @@ - + - diff --git a/res/drawable-hdpi/ic_qquest.png b/res/drawable-hdpi/ic_rtcwquest.png similarity index 100% rename from res/drawable-hdpi/ic_qquest.png rename to res/drawable-hdpi/ic_rtcwquest.png diff --git a/res/drawable-mdpi/ic_qquest.png b/res/drawable-mdpi/ic_rtcwquest.png similarity index 100% rename from res/drawable-mdpi/ic_qquest.png rename to res/drawable-mdpi/ic_rtcwquest.png diff --git a/res/drawable-xhdpi/ic_qquest.png b/res/drawable-xhdpi/ic_rtcwquest.png similarity index 100% rename from res/drawable-xhdpi/ic_qquest.png rename to res/drawable-xhdpi/ic_rtcwquest.png diff --git a/res/drawable-xxhdpi/ic_qquest.png b/res/drawable-xxhdpi/ic_rtcwquest.png similarity index 100% rename from res/drawable-xxhdpi/ic_qquest.png rename to res/drawable-xxhdpi/ic_rtcwquest.png diff --git a/res/values/strings.xml b/res/values/strings.xml index 944b182..a91dad7 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5,6 +5,6 @@ - Quake2Quest + RTCWQuest