diff --git a/.gitignore b/.gitignore index a39c352..f280047 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,6 @@ Projects/Android/.gradle/4.6/fileHashes/fileHashes.lock Projects/Android/.gradle/vcsWorkingDirs/gc.properties drbeef-release-key.keystore assets/pak6.pak +Projects/Android/Android.iml +Projects/Projects.iml +VrSamples-Quake2Quest.iml diff --git a/Projects/Android/Android.iml b/Projects/Android/Android.iml index 2cbdca9..3da9fb7 100644 --- a/Projects/Android/Android.iml +++ b/Projects/Android/Android.iml @@ -1,14 +1,16 @@ - + - @@ -21,38 +23,117 @@ - - + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + - - - + + + @@ -83,14 +164,6 @@ - - - - - - - - @@ -99,38 +172,18 @@ + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -143,9 +196,9 @@ - - + + \ No newline at end of file diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 5b7f173..f1793ca 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="14" + android:versionName="1.0.3" android:installLocation="auto" > diff --git a/Projects/Android/jni/Quake2VR/Q2VR_SurfaceView.c b/Projects/Android/jni/Quake2VR/Q2VR_SurfaceView.c index c863162..684ceb9 100644 --- a/Projects/Android/jni/Quake2VR/Q2VR_SurfaceView.c +++ b/Projects/Android/jni/Quake2VR/Q2VR_SurfaceView.c @@ -1316,10 +1316,11 @@ long shutdownCountdown; int m_width; int m_height; +static ovrJava java; qboolean R_SetMode( void ); -void Android_GetScreenRes(int *width, int *height) +void Quest_GetScreenRes(int *width, int *height) { if (useScreenLayer()) { @@ -1331,7 +1332,17 @@ void Android_GetScreenRes(int *width, int *height) } } -void Android_MessageBox(const char *title, const char *text) +int Quest_GetRefresh() +{ + return vrapi_GetSystemPropertyInt( &java, VRAPI_SYS_PROP_DISPLAY_REFRESH_RATE ); +} + +float getFOV() +{ + return vrapi_GetSystemPropertyFloat( &java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X ); +} + +void Quest_MessageBox(const char *title, const char *text) { ALOGE("%s %s", title, text); } @@ -1382,7 +1393,6 @@ void * AppThreadFunction( void * parm ) { ovrAppThread * appThread = (ovrAppThread *)parm; - ovrJava java; java.Vm = appThread->JavaVm; (*java.Vm)->AttachCurrentThread( java.Vm, &java.Env, NULL ); java.ActivityObject = appThread->ActivityObject; diff --git a/Projects/Android/jni/Quake2VR/VrInputDefault.c b/Projects/Android/jni/Quake2VR/VrInputDefault.c index abff774..bd58ebc 100644 --- a/Projects/Android/jni/Quake2VR/VrInputDefault.c +++ b/Projects/Android/jni/Quake2VR/VrInputDefault.c @@ -38,19 +38,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, static float dominantGripPushTime = 0.0f; static qboolean inventoryManagementMode = false; - //Show screen view (if in multiplayer toggle scoreboard) - if (((pOffTrackedRemoteNew->Buttons & offButton2) != - (pOffTrackedRemoteOld->Buttons & offButton2)) && - (pOffTrackedRemoteNew->Buttons & offButton2)) { - - showingScreenLayer = !showingScreenLayer; - - //Check we are in multiplayer - if (isMultiplayer()) { - sendButtonActionSimple("score"); - } - } - //Menu button handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, K_ESCAPE); @@ -133,11 +120,11 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, } } - if ((pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != - (pDominantTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) { - + if ((pOffTrackedRemoteNew->Buttons & offButton2) != + (pOffTrackedRemoteOld->Buttons & offButton2)) + { sendButtonActionSimple("inven"); - inventoryManagementMode = (pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) > 0; + inventoryManagementMode = (pOffTrackedRemoteNew->Buttons & offButton2) > 0; } } diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/array.c b/Projects/Android/jni/SupportLibs/gl4es/src/gl/array.c index a9cf42a..ab0f727 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/array.c +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/array.c @@ -446,7 +446,7 @@ GLvoid *copy_gl_pointer_color_bgra(const void *ptr, GLint stride, GLsizei width, #ifdef __ARM_NEON__ int lsrc = *(int*)src; lsrc = (lsrc&0xff00ff00) | ((lsrc&0x00ff0000)>>16) | ((lsrc&0x000000ff)<<16); - asm volatile ( + __asm volatile ( "vmov s12, %1 \n\t" // because you cannot vmovl.u8 d6, s11 "vmovl.u8 q3, d6 \n\t" // Expand to 16-bit (so unsetuped s13 is expanded in d7) "vmovl.u16 q3, d6 \n\t" // Expand to 32-bit, ignoring expanded d7 diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/matvec.c b/Projects/Android/jni/SupportLibs/gl4es/src/gl/matvec.c index 2c91f83..db43da2 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/matvec.c +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/matvec.c @@ -9,7 +9,7 @@ float FASTMATH dot(const float *a, const float *b) { float FASTMATH dot4(const float *a, const float *b) { #ifdef __ARM_NEON__ register float ret; - asm volatile ( + __asm volatile ( "vld1.f32 {d0-d1}, [%1] \n" //q0 = a(0..3) "vld1.f32 {d2-d3}, [%2] \n" //q1 = b(0..3) "vmul.f32 q0, q0, q1 \n" //q0 = a(0)*b(0),a(1)*b(1),a(2)*b(2),a(3)*b(3) @@ -35,7 +35,7 @@ float cross3(const float *a, const float *b, float* c) { void matrix_vector(const float *a, const float *b, float *c) { #ifdef __ARM_NEON__ const float* a1 = a+8; - asm volatile ( + __asm volatile ( "vld4.f32 {d0,d2,d4,d6}, [%1] \n" "vld4.f32 {d1,d3,d5,d7}, [%2] \n" // q0-q3 = a(0,4,8,12/1,5,9,13/2,6,10,14/3,7,11,15) "vld1.f32 {q4}, [%3] \n" // q4 = b @@ -60,7 +60,7 @@ void vector_matrix(const float *a, const float *b, float *c) { const float* b2=b+4; const float* b3=b+8; const float* b4=b+12; - asm volatile ( + __asm volatile ( "vld1.f32 {q0}, [%1] \n" // %q0 = a(0..3) "vld1.f32 {q1}, [%2] \n" // %q1 = b(0..3) "vmul.f32 q1, q1, d0[0] \n" // %q1 = b(0..3)*a[0] @@ -88,7 +88,7 @@ void vector3_matrix(const float *a, const float *b, float *c) { const float* b2=b+4; const float* b3=b+8; const float* b4=b+12; - asm volatile ( + __asm volatile ( //"vld1.f32 {q0}, [%1] \n" // %q0 = a(0..2) "vld1.32 {d0}, [%1] \n" "flds s2, [%1, #8] \n" @@ -127,7 +127,7 @@ void vector3_matrix3(const float *a, const float *b, float *c) { void vector_normalize(float *a) { #ifdef __ARM_NEON__ - asm volatile ( + __asm volatile ( "vld1.32 {d4}, [%0] \n\t" //d4={x0,y0} "flds s10, [%0, #8] \n\t" //d5[0]={z0} "vsub.f32 s11, s11, s11 \n\t" @@ -162,7 +162,7 @@ void vector_normalize(float *a) { void vector4_normalize(float *a) { #ifdef __ARM_NEON__ - asm volatile ( + __asm volatile ( "vld1.32 {q2}, [%0] \n\t" //q2={x0,y0,z0,00} "vmul.f32 d0, d4, d4 \n\t" //d0= d4*d4 @@ -199,7 +199,7 @@ void FASTMATH matrix_transpose(const float *a, float *b) { #ifdef __ARM_NEON__ const float* a1 = a+8; float* b1=b+8; - asm volatile ( + __asm volatile ( "vld4.f32 {d0,d2,d4,d6}, [%1] \n" "vld4.f32 {d1,d3,d5,d7}, [%2] \n" // %q0-%q3 = a(0,4,8,12/1,5,9,13/2,6,10,14/3,7,11,15) "vst1.f32 {d0-d3}, [%0] \n" @@ -263,7 +263,7 @@ void matrix_mul(const float *a, const float *b, float *c) { const float* a1 = a+8; const float* b1=b+8; float* c1=c+8; - asm volatile ( + __asm volatile ( "vld1.32 {d16-d19}, [%2] \n" "vld1.32 {d20-d23}, [%3] \n" "vld1.32 {d0-d3}, [%4] \n" diff --git a/Projects/Android/jni/quake2/Android.mk b/Projects/Android/jni/quake2/Android.mk index 1ed4527..f3ebf44 100644 --- a/Projects/Android/jni/quake2/Android.mk +++ b/Projects/Android/jni/quake2/Android.mk @@ -104,8 +104,8 @@ LOCAL_SRC_FILES := $(CLIENT_OBJS_:.o=.c) \ LOCAL_LDLIBS := -lEGL -ldl -llog -landroid -lOpenSLES -lz -LOCAL_STATIC_LIBRARIES := sigc libzip libpng libjpeg -LOCAL_SHARED_LIBRARIES := gl4es SDL2 SDL2_mixer vrapi +LOCAL_STATIC_LIBRARIES := gl4es sigc libzip libpng libjpeg +LOCAL_SHARED_LIBRARIES := SDL2 SDL2_mixer vrapi LOCAL_LDLIBS += -lGLESv3 include $(BUILD_SHARED_LIBRARY) diff --git a/Projects/Android/jni/quake2/src/client/cl_main.c b/Projects/Android/jni/quake2/src/client/cl_main.c index 59f0eda..4548b7c 100644 --- a/Projects/Android/jni/quake2/src/client/cl_main.c +++ b/Projects/Android/jni/quake2/src/client/cl_main.c @@ -71,7 +71,6 @@ cvar_t *cl_lightlevel; cvar_t *name; cvar_t *skin; cvar_t *rate; -cvar_t *fov; cvar_t *horplus; cvar_t *windowed_mouse; cvar_t *msg; @@ -532,7 +531,6 @@ CL_InitLocal(void) rate = Cvar_Get("rate", "8000", CVAR_USERINFO | CVAR_ARCHIVE); msg = Cvar_Get("msg", "1", CVAR_USERINFO | CVAR_ARCHIVE); hand = Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE); - fov = Cvar_Get("fov", "104", CVAR_USERINFO | CVAR_ARCHIVE); horplus = Cvar_Get("horplus", "0", CVAR_ARCHIVE); windowed_mouse = Cvar_Get("windowed_mouse", "1", CVAR_USERINFO | CVAR_ARCHIVE); gender = Cvar_Get("gender", "male", CVAR_USERINFO | CVAR_ARCHIVE); diff --git a/Projects/Android/jni/quake2/src/client/menu/videomenu.c b/Projects/Android/jni/quake2/src/client/menu/videomenu.c index dd9c451..5dbc13e 100644 --- a/Projects/Android/jni/quake2/src/client/menu/videomenu.c +++ b/Projects/Android/jni/quake2/src/client/menu/videomenu.c @@ -37,7 +37,6 @@ static cvar_t *r_hudscale; static cvar_t *r_consolescale; static cvar_t *r_menuscale; static cvar_t *crosshair_scale; -static cvar_t *fov; extern cvar_t *scr_viewsize; extern cvar_t *vid_gamma; extern cvar_t *vid_fullscreen; @@ -361,11 +360,6 @@ VID_MenuInit(void) crosshair_scale = Cvar_Get("crosshair_scale", "-1", CVAR_ARCHIVE); } - if (!fov) - { - fov = Cvar_Get("fov", "104", CVAR_USERINFO | CVAR_ARCHIVE); - } - if (!vid_gamma) { vid_gamma = Cvar_Get("vid_gamma", "1.2", CVAR_ARCHIVE); diff --git a/Projects/Android/jni/quake2/src/client/refresh/gl1/gl1_main.c b/Projects/Android/jni/quake2/src/client/refresh/gl1/gl1_main.c index 045d81e..972de40 100644 --- a/Projects/Android/jni/quake2/src/client/refresh/gl1/gl1_main.c +++ b/Projects/Android/jni/quake2/src/client/refresh/gl1/gl1_main.c @@ -79,7 +79,6 @@ cvar_t *r_fullbright; cvar_t *r_novis; cvar_t *r_lerpmodels; cvar_t *gl_lefthand; -cvar_t *r_gunfov; cvar_t *r_farsee; cvar_t *vr_lasersight; @@ -1221,7 +1220,6 @@ R_Register(void) vr_lasersight = ri.Cvar_Get("vr_lasersight", "0", CVAR_LATCH); vr_weaponscale = ri.Cvar_Get("vr_weaponscale", "0.56", CVAR_ARCHIVE); - r_gunfov = ri.Cvar_Get("r_gunfov", "80", CVAR_ARCHIVE); r_farsee = ri.Cvar_Get("r_farsee", "0", CVAR_LATCH | CVAR_ARCHIVE); r_norefresh = ri.Cvar_Get("r_norefresh", "0", 0); r_fullbright = ri.Cvar_Get("r_fullbright", "0", 0); diff --git a/Projects/Android/jni/quake2/src/client/refresh/gl1/header/local.h b/Projects/Android/jni/quake2/src/client/refresh/gl1/header/local.h index 003c6bf..5000000 100644 --- a/Projects/Android/jni/quake2/src/client/refresh/gl1/header/local.h +++ b/Projects/Android/jni/quake2/src/client/refresh/gl1/header/local.h @@ -166,7 +166,6 @@ extern int r_viewcluster, r_viewcluster2, r_oldviewcluster, r_oldviewcluster2; extern cvar_t *r_norefresh; extern cvar_t *gl_lefthand; -extern cvar_t *r_gunfov; extern cvar_t *r_farsee; extern cvar_t *r_drawentities; extern cvar_t *r_drawworld; diff --git a/Projects/Android/jni/quake2/src/client/refresh/gl3/gl3_main.c b/Projects/Android/jni/quake2/src/client/refresh/gl3/gl3_main.c index bf9d97b..85bd75a 100644 --- a/Projects/Android/jni/quake2/src/client/refresh/gl3/gl3_main.c +++ b/Projects/Android/jni/quake2/src/client/refresh/gl3/gl3_main.c @@ -97,7 +97,6 @@ cvar_t *gl3_particle_square; cvar_t *vr_lasersight; cvar_t *gl_lefthand; -cvar_t *r_gunfov; cvar_t *r_farsee; cvar_t *gl3_intensity; @@ -194,7 +193,6 @@ GL3_Register(void) { vr_lasersight = ri.Cvar_Get("vr_lasersight", "0", CVAR_LATCH); gl_lefthand = ri.Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE); - r_gunfov = ri.Cvar_Get("r_gunfov", "104", CVAR_ARCHIVE); r_farsee = ri.Cvar_Get("r_farsee", "0", CVAR_LATCH | CVAR_ARCHIVE); gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0); diff --git a/Projects/Android/jni/quake2/src/client/refresh/gl3/header/local.h b/Projects/Android/jni/quake2/src/client/refresh/gl3/header/local.h index 4283667..2d17823 100644 --- a/Projects/Android/jni/quake2/src/client/refresh/gl3/header/local.h +++ b/Projects/Android/jni/quake2/src/client/refresh/gl3/header/local.h @@ -507,7 +507,6 @@ extern cvar_t *r_fullbright; extern cvar_t *r_norefresh; extern cvar_t *gl_lefthand; -extern cvar_t *r_gunfov; extern cvar_t *r_farsee; extern cvar_t *r_drawworld; diff --git a/Projects/Android/jni/quake2/src/client/refresh/soft/sw_main.c b/Projects/Android/jni/quake2/src/client/refresh/soft/sw_main.c index 2278873..c8a23cc 100644 --- a/Projects/Android/jni/quake2/src/client/refresh/soft/sw_main.c +++ b/Projects/Android/jni/quake2/src/client/refresh/soft/sw_main.c @@ -235,7 +235,6 @@ R_RegisterVariables (void) r_mode = ri.Cvar_Get( "r_mode", "0", CVAR_ARCHIVE ); r_lefthand = ri.Cvar_Get( "hand", "0", CVAR_USERINFO | CVAR_ARCHIVE ); - r_gunfov = ri.Cvar_Get( "r_gunfov", "104", CVAR_ARCHIVE ); r_speeds = ri.Cvar_Get ("r_speeds", "0", 0); r_fullbright = ri.Cvar_Get ("r_fullbright", "0", 0); r_drawentities = ri.Cvar_Get ("r_drawentities", "1", 0); diff --git a/Projects/Android/jni/quake2/src/client/vid/glimp_android.c b/Projects/Android/jni/quake2/src/client/vid/glimp_android.c index 75bc4fe..3de97b5 100644 --- a/Projects/Android/jni/quake2/src/client/vid/glimp_android.c +++ b/Projects/Android/jni/quake2/src/client/vid/glimp_android.c @@ -43,7 +43,8 @@ cvar_t *m_up; cvar_t *m_yaw; cvar_t *sensitivity; -void Android_GetScreenRes(int *width, int *height); +void Quest_GetScreenRes(int *width, int *height); +int Quest_GetRefresh(); qboolean GLimp_Init(void) { return true; } void GLimp_Shutdown(void) {} @@ -60,10 +61,10 @@ qboolean GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight) } void GLimp_ShutdownGraphics(void) {} void GLimp_GrabInput(qboolean grab) {} -int GLimp_GetRefreshRate(void) { return 72; } // Returen Quest refresh rate +int GLimp_GetRefreshRate(void) { return Quest_GetRefresh(); } // Returen Quest refresh rate qboolean GLimp_GetDesktopMode(int *pwidth, int *pheight) { - Android_GetScreenRes(pwidth, pheight); + Quest_GetScreenRes(pwidth, pheight); return 1; //bettter } diff --git a/Projects/Android/jni/quake2/src/common/header/common.h b/Projects/Android/jni/quake2/src/common/header/common.h index 1b4477d..472cada 100644 --- a/Projects/Android/jni/quake2/src/common/header/common.h +++ b/Projects/Android/jni/quake2/src/common/header/common.h @@ -32,7 +32,7 @@ #include "shared.h" #include "crc.h" -#define Q2QVERSION "1.0.2" +#define Q2QVERSION "1.0.3" #define YQ2VERSION "7.41" #define BASEDIRNAME "Quake2Quest" diff --git a/Projects/Android/jni/quake2/src/common/header/shared.h b/Projects/Android/jni/quake2/src/common/header/shared.h index c2d629d..26ceb6c 100644 --- a/Projects/Android/jni/quake2/src/common/header/shared.h +++ b/Projects/Android/jni/quake2/src/common/header/shared.h @@ -234,6 +234,7 @@ void RotatePointAroundVector(vec3_t dst, void Android_Vibrate( float duration, int channel, float intensity ); void getVROrigins(vec3_t weaponoffset, vec3_t weaponangles, vec3_t hmdPosition); +float getFOV(); /* ============================================= */ diff --git a/Projects/Android/jni/quake2/src/game/header/game.h b/Projects/Android/jni/quake2/src/game/header/game.h index 16d9f65..91d76e6 100644 --- a/Projects/Android/jni/quake2/src/game/header/game.h +++ b/Projects/Android/jni/quake2/src/game/header/game.h @@ -174,6 +174,7 @@ typedef struct //VR Stuff void (*HapticVibrate)( float duration, int channel, float intensity ); void (*getVROrigins)(vec3_t weaponoffset, vec3_t weaponangles, vec3_t hmdPosition); + float (*getFOV)( ); /* ClientCommand and ServerCommand parameter access */ int (*argc)(void); diff --git a/Projects/Android/jni/quake2/src/game/player/client.c b/Projects/Android/jni/quake2/src/game/player/client.c index 71ae8d8..19a6e4f 100644 --- a/Projects/Android/jni/quake2/src/game/player/client.c +++ b/Projects/Android/jni/quake2/src/game/player/client.c @@ -1736,25 +1736,7 @@ PutClientInServer(edict_t *ent) client->ps.pmove.origin[1] = spawn_origin[1] * 8; client->ps.pmove.origin[2] = spawn_origin[2] * 8; -/* if (deathmatch->value && ((int)dmflags->value & DF_FIXED_FOV)) - { - client->ps.fov = 104; - } - else - { - client->ps.fov = (int)strtol(Info_ValueForKey(client->pers.userinfo, "fov"), (char **)NULL, 10); - - if (client->ps.fov < 1) - { - client->ps.fov = 104; - } - else if (client->ps.fov > 160) - { - client->ps.fov = 160; - } - }*/ - - client->ps.fov = 104; + client->ps.fov = gi.getFOV(); client->ps.gunindex = gi.modelindex(client->pers.weapon->view_model); @@ -1991,7 +1973,7 @@ ClientUserinfoChanged(edict_t *ent, char *userinfo) ent->client->ps.fov = 160; } }*/ - ent->client->ps.fov = 104; + ent->client->ps.fov = gi.getFOV(); /* handedness */ s = Info_ValueForKey(userinfo, "hand"); diff --git a/Projects/Android/jni/quake2/src/game/player/view.c b/Projects/Android/jni/quake2/src/game/player/view.c index 2cd7fc9..f03babc 100644 --- a/Projects/Android/jni/quake2/src/game/player/view.c +++ b/Projects/Android/jni/quake2/src/game/player/view.c @@ -1128,7 +1128,7 @@ ClientEndServerFrame(edict_t *ent) if (level.intermissiontime) { current_client->ps.blend[3] = 0; - current_client->ps.fov = 104; + current_client->ps.fov = gi.getFOV(); G_SetStats(ent); return; } diff --git a/Projects/Android/jni/quake2/src/server/sv_game.c b/Projects/Android/jni/quake2/src/server/sv_game.c index ca6a873..6e030eb 100644 --- a/Projects/Android/jni/quake2/src/server/sv_game.c +++ b/Projects/Android/jni/quake2/src/server/sv_game.c @@ -432,6 +432,7 @@ SV_InitGameProgs(void) import.HapticVibrate = Android_Vibrate; import.getVROrigins = getVROrigins; + import.getFOV = getFOV; import.argc = Cmd_Argc; import.argv = Cmd_Argv; diff --git a/Projects/Projects.iml b/Projects/Projects.iml index 9a9a2ac..ece1462 100644 --- a/Projects/Projects.iml +++ b/Projects/Projects.iml @@ -1,9 +1,11 @@ - + diff --git a/VrSamples-Quake2Quest.iml b/VrSamples-Quake2Quest.iml index fb8ee18..ece82c6 100644 --- a/VrSamples-Quake2Quest.iml +++ b/VrSamples-Quake2Quest.iml @@ -1,9 +1,11 @@ - +