mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 14:52:00 +00:00
Mostly VR Options Menu
Some other things in there too: - Incomplete implementation of scoped zoom for rail gun (needs more work) - VR Options Menu - Incomplete / Failed attempt at accessing the Android keyboard, leaving in case some revelation occurs -
This commit is contained in:
parent
2a5f027d59
commit
08193518cc
23 changed files with 806 additions and 129 deletions
1
Makefile
1
Makefile
|
@ -2656,6 +2656,7 @@ Q3UIOBJ_ = \
|
|||
$(B)/$(BASEGAME)/ui/ui_team.o \
|
||||
$(B)/$(BASEGAME)/ui/ui_teamorders.o \
|
||||
$(B)/$(BASEGAME)/ui/ui_video.o \
|
||||
$(B)/$(BASEGAME)/ui/ui_vr.o \
|
||||
\
|
||||
$(B)/$(BASEGAME)/qcommon/q_math.o \
|
||||
$(B)/$(BASEGAME)/qcommon/q_shared.o
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.ioq3quest"
|
||||
android:installLocation="preferExternal"
|
||||
android:versionCode="17"
|
||||
android:versionName="0.12.0">
|
||||
android:versionCode="20"
|
||||
android:versionName="0.13.1">
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
|
||||
<uses-feature android:glEsVersion="0x00030001" />
|
||||
<!-- <uses-feature android:name="oculus.software.overlay_keyboard" android:required="false"/>-->
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
|
|
@ -29,12 +29,13 @@ static JNIEnv* g_Env = NULL;
|
|||
static JavaVM* g_JavaVM = NULL;
|
||||
static jobject g_ActivityObject = NULL;
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
JNIEXPORT void JNICALL Java_com_drbeef_ioq3quest_MainActivity_nativeCreate(JNIEnv* env, jclass cls, jobject thisObject)
|
||||
{
|
||||
g_ActivityObject = env->NewGlobalRef(thisObject);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
{
|
||||
|
@ -45,6 +46,20 @@ extern "C"
|
|||
|
||||
return JNI_VERSION_1_4;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_drbeef_ioq3quest_MainActivity_nativeKeyDown(JNIEnv* env, jclass cls, jobject thisObject,
|
||||
jint var1 , jint var2 )
|
||||
{
|
||||
char buffer[10];
|
||||
Com_sprintf(buffer, 10, "%c", (char)var2);
|
||||
Cbuf_AddText(buffer);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_drbeef_ioq3quest_MainActivity_nativeKeyUp(JNIEnv* env, jclass cls, jobject thisObject,
|
||||
jint var1 , jint var2)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void ioq3_logfn(const char* msg)
|
||||
|
|
|
@ -7,6 +7,8 @@ import android.content.res.AssetManager;
|
|||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
@ -29,7 +31,7 @@ import java.util.zip.ZipInputStream;
|
|||
|
||||
import static android.system.Os.setenv;
|
||||
|
||||
public class MainActivity extends SDLActivity
|
||||
public class MainActivity extends SDLActivity // implements KeyEvent.Callback
|
||||
{
|
||||
private int permissionCount = 0;
|
||||
private static final int READ_EXTERNAL_STORAGE_PERMISSION_ID = 1;
|
||||
|
@ -40,34 +42,36 @@ public class MainActivity extends SDLActivity
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.i(TAG,"onCreate called");
|
||||
Log.i(TAG, "onCreate called");
|
||||
try {
|
||||
checkPermissionsAndInitialize();
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
//imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
}
|
||||
|
||||
/** Initializes the Activity only if the permission has been granted. */
|
||||
|
||||
/**
|
||||
* Initializes the Activity only if the permission has been granted.
|
||||
*/
|
||||
private void checkPermissionsAndInitialize() throws IOException {
|
||||
// Boilerplate for checking runtime permissions in Android.
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
!= PackageManager.PERMISSION_GRANTED){
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
WRITE_EXTERNAL_STORAGE_PERMISSION_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Permissions have already been granted.
|
||||
create();
|
||||
}
|
||||
}
|
||||
|
||||
/** Handles the user accepting the permission. */
|
||||
/**
|
||||
* Handles the user accepting the permission.
|
||||
*/
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] results) {
|
||||
if (requestCode == WRITE_EXTERNAL_STORAGE_PERMISSION_ID) {
|
||||
|
@ -134,8 +138,7 @@ public class MainActivity extends SDLActivity
|
|||
commandLineParams = new String();
|
||||
|
||||
//See if user is trying to use command line params
|
||||
if (new File("/sdcard/ioquake3Quest/commandline.txt").exists())
|
||||
{
|
||||
if (new File("/sdcard/ioquake3Quest/commandline.txt").exists()) {
|
||||
BufferedReader br;
|
||||
try {
|
||||
br = new BufferedReader(new FileReader("/sdcard/ioquake3Quest/commandline.txt"));
|
||||
|
@ -158,9 +161,7 @@ public class MainActivity extends SDLActivity
|
|||
Log.d(TAG, "setting env");
|
||||
try {
|
||||
setenv("commandline", commandLineParams, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
Log.d(TAG, "nativeCreate");
|
||||
|
@ -210,8 +211,43 @@ public class MainActivity extends SDLActivity
|
|||
}
|
||||
|
||||
public static native void nativeCreate(MainActivity thisObject);
|
||||
public static native void nativeKeyDown(MainActivity thisObject, int var1, int var2);
|
||||
public static native void nativeKeyUp(MainActivity thisObject, int var1, int var2);
|
||||
|
||||
static {
|
||||
System.loadLibrary("main");
|
||||
}
|
||||
|
||||
public void showkeyboard() {
|
||||
|
||||
//InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
//imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
}
|
||||
/*
|
||||
// Key events
|
||||
@Override
|
||||
public boolean onKeyDown(int var1, KeyEvent var2)
|
||||
{
|
||||
nativeKeyDown(this, var1, var2.getKeyCode());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyLongPress(int var1, KeyEvent var2)
|
||||
{
|
||||
nativeKeyUp(this, var1, var2.getKeyCode());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int var1, KeyEvent var2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyMultiple(int var1, int var2, KeyEvent var3)
|
||||
{
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -2570,8 +2570,8 @@ static void CG_Draw2D(stereoFrame_t stereoFrame)
|
|||
if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) {
|
||||
CG_DrawSpectator();
|
||||
|
||||
if(stereoFrame == STEREO_CENTER)
|
||||
CG_DrawCrosshair();
|
||||
// if(stereoFrame == STEREO_CENTER)
|
||||
// CG_DrawCrosshair();
|
||||
|
||||
CG_DrawCrosshairNames();
|
||||
} else {
|
||||
|
@ -2591,9 +2591,12 @@ static void CG_Draw2D(stereoFrame_t stereoFrame)
|
|||
|
||||
#ifdef MISSIONPACK
|
||||
CG_DrawProxWarning();
|
||||
#endif
|
||||
if(stereoFrame == STEREO_CENTER)
|
||||
#endif
|
||||
|
||||
//Use 2D crosshair when using weapon zoom
|
||||
if(vr->weapon_zoomed)
|
||||
CG_DrawCrosshair();
|
||||
|
||||
CG_DrawCrosshairNames();
|
||||
CG_DrawWeaponSelect();
|
||||
|
||||
|
@ -2666,7 +2669,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
// clear around the rendered view if sized down
|
||||
CG_TileClear();
|
||||
|
||||
if(stereoView != STEREO_CENTER)
|
||||
if(!vr->weapon_zoomed)
|
||||
CG_DrawCrosshair3D();
|
||||
|
||||
// offset vieworg appropriately if we're doing stereo separation
|
||||
|
@ -2710,7 +2713,8 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
}
|
||||
}
|
||||
|
||||
VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg);
|
||||
float zoomCoeff = ((2.5f-vr->weapon_zoomLevel)/1.5f);
|
||||
VectorMA(cg.refdef.vieworg, -separation * zoomCoeff, cg.refdef.viewaxis[1], cg.refdef.vieworg);
|
||||
|
||||
// draw 3D view
|
||||
trap_R_RenderScene( &cg.refdef );
|
||||
|
|
|
@ -47,7 +47,8 @@ Adjusted for resolution and screen aspect ratio
|
|||
*/
|
||||
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||
|
||||
if (vr->virtual_screen)
|
||||
if (vr->virtual_screen ||
|
||||
vr->weapon_zoomed)
|
||||
{
|
||||
// scale for screen sizes
|
||||
*x *= cgs.screenXScale;
|
||||
|
|
|
@ -583,59 +583,71 @@ void CG_GibPlayer( vec3_t playerOrigin ) {
|
|||
return;
|
||||
}
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibAbdomen );
|
||||
//Allows lots of extra gibs - woohoo gore!
|
||||
int megagibs = cg_megagibs.integer ? 1 : 0;
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibArm );
|
||||
int i;
|
||||
for (i = 0; i < (1 + (megagibs * 2)); ++i) {
|
||||
VectorCopy(playerOrigin, origin);
|
||||
velocity[0] = crandom() * GIB_VELOCITY;
|
||||
velocity[1] = crandom() * GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom() * GIB_VELOCITY;
|
||||
CG_LaunchGib(origin, velocity, cgs.media.gibAbdomen);
|
||||
}
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibChest );
|
||||
for (i = 0; i < (1 + megagibs); ++i) {
|
||||
VectorCopy(playerOrigin, origin);
|
||||
velocity[0] = crandom() * GIB_VELOCITY;
|
||||
velocity[1] = crandom() * GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom() * GIB_VELOCITY;
|
||||
CG_LaunchGib(origin, velocity, cgs.media.gibArm);
|
||||
}
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibFist );
|
||||
VectorCopy(playerOrigin, origin);
|
||||
velocity[0] = crandom() * GIB_VELOCITY;
|
||||
velocity[1] = crandom() * GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom() * GIB_VELOCITY;
|
||||
CG_LaunchGib(origin, velocity, cgs.media.gibChest);
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibFoot );
|
||||
for (i = 0; i < (1 + megagibs); ++i) {
|
||||
VectorCopy(playerOrigin, origin);
|
||||
velocity[0] = crandom() * GIB_VELOCITY;
|
||||
velocity[1] = crandom() * GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom() * GIB_VELOCITY;
|
||||
CG_LaunchGib(origin, velocity, cgs.media.gibFist);
|
||||
}
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibForearm );
|
||||
for (i = 0; i < (1 + megagibs); ++i) {
|
||||
VectorCopy(playerOrigin, origin);
|
||||
velocity[0] = crandom() * GIB_VELOCITY;
|
||||
velocity[1] = crandom() * GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom() * GIB_VELOCITY;
|
||||
CG_LaunchGib(origin, velocity, cgs.media.gibFoot);
|
||||
}
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibIntestine );
|
||||
for (i = 0; i < (1 + megagibs); ++i) {
|
||||
VectorCopy(playerOrigin, origin);
|
||||
velocity[0] = crandom() * GIB_VELOCITY;
|
||||
velocity[1] = crandom() * GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom() * GIB_VELOCITY;
|
||||
CG_LaunchGib(origin, velocity, cgs.media.gibForearm);
|
||||
}
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibLeg );
|
||||
for (i = 0; i < (1 + megagibs); ++i) {
|
||||
VectorCopy(playerOrigin, origin);
|
||||
velocity[0] = crandom() * GIB_VELOCITY;
|
||||
velocity[1] = crandom() * GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom() * GIB_VELOCITY;
|
||||
CG_LaunchGib(origin, velocity, cgs.media.gibIntestine);
|
||||
}
|
||||
|
||||
VectorCopy( playerOrigin, origin );
|
||||
velocity[0] = crandom()*GIB_VELOCITY;
|
||||
velocity[1] = crandom()*GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom()*GIB_VELOCITY;
|
||||
CG_LaunchGib( origin, velocity, cgs.media.gibLeg );
|
||||
for (i = 0; i < (1 + megagibs); ++i) {
|
||||
VectorCopy(playerOrigin, origin);
|
||||
velocity[0] = crandom() * GIB_VELOCITY;
|
||||
velocity[1] = crandom() * GIB_VELOCITY;
|
||||
velocity[2] = GIB_JUMP + crandom() * GIB_VELOCITY;
|
||||
CG_LaunchGib(origin, velocity, cgs.media.gibLeg);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -891,7 +891,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
|
|||
DEBUGNAME("EV_PLAYER_TELEPORT_IN");
|
||||
trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.teleInSound );
|
||||
CG_SpawnEffect( position);
|
||||
vr->realign_weapon = qtrue; // auto trigger weapon re-align
|
||||
vr->realign_playspace = qtrue; // auto trigger weapon re-align
|
||||
break;
|
||||
|
||||
case EV_PLAYER_TELEPORT_OUT:
|
||||
|
|
|
@ -1101,6 +1101,7 @@ extern vmCvar_t cg_weaponbob;
|
|||
extern vmCvar_t cg_swingSpeed;
|
||||
extern vmCvar_t cg_shadows;
|
||||
extern vmCvar_t cg_gibs;
|
||||
extern vmCvar_t cg_megagibs;
|
||||
extern vmCvar_t cg_drawTimer;
|
||||
extern vmCvar_t cg_drawFPS;
|
||||
extern vmCvar_t cg_drawSnapshot;
|
||||
|
|
|
@ -107,6 +107,7 @@ vmCvar_t cg_weaponbob;
|
|||
vmCvar_t cg_swingSpeed;
|
||||
vmCvar_t cg_shadows;
|
||||
vmCvar_t cg_gibs;
|
||||
vmCvar_t cg_megagibs;
|
||||
vmCvar_t cg_drawTimer;
|
||||
vmCvar_t cg_drawFPS;
|
||||
vmCvar_t cg_drawSnapshot;
|
||||
|
@ -225,6 +226,7 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_viewsize, "cg_viewsize", "100", CVAR_ARCHIVE },
|
||||
{ &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
|
||||
{ &cg_gibs, "cg_gibs", "1", CVAR_ARCHIVE },
|
||||
{ &cg_megagibs, "cg_megagibs", "1", CVAR_ARCHIVE },
|
||||
{ &cg_draw2D, "cg_draw2D", "1", CVAR_ARCHIVE },
|
||||
{ &cg_drawStatus, "cg_drawStatus", "1", CVAR_ARCHIVE },
|
||||
{ &cg_drawTimer, "cg_drawTimer", "0", CVAR_ARCHIVE },
|
||||
|
|
|
@ -706,14 +706,31 @@ static int CG_CalcViewValues( void ) {
|
|||
// position eye relative to origin
|
||||
if (!cgs.localServer)
|
||||
{
|
||||
//We are connected to a multiplayer server, so make the appropriate adjustment to the view
|
||||
//angles as we send orientation to the server that includes the weapon angles
|
||||
vec3_t angles;
|
||||
VectorCopy(vr->hmdorientation, angles);
|
||||
angles[YAW] = (cg.refdefViewAngles[YAW] + vr->hmdorientation[YAW]) - vr->weaponangles[YAW];
|
||||
AnglesToAxis( angles, cg.refdef.viewaxis );
|
||||
if (vr->weapon_zoomed) {
|
||||
//If we are zoomed, then we use the refdefViewANgles (which are the weapon angles)
|
||||
vec3_t angles;
|
||||
VectorCopy(cg.refdefViewAngles, angles);
|
||||
angles[ROLL] = 0;
|
||||
AnglesToAxis( angles, cg.refdef.viewaxis );
|
||||
} else {
|
||||
//We are connected to a multiplayer server, so make the appropriate adjustment to the view
|
||||
//angles as we send orientation to the server that includes the weapon angles
|
||||
vec3_t angles;
|
||||
VectorCopy(vr->hmdorientation, angles);
|
||||
angles[YAW] =
|
||||
(cg.refdefViewAngles[YAW] + vr->hmdorientation[YAW]) - vr->weaponangles[YAW];
|
||||
AnglesToAxis(angles, cg.refdef.viewaxis);
|
||||
}
|
||||
} else {
|
||||
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
|
||||
if (vr->weapon_zoomed) {
|
||||
vec3_t angles;
|
||||
angles[ROLL] = 0;
|
||||
angles[PITCH] = vr->weaponangles[PITCH];
|
||||
angles[YAW] = (cg.refdefViewAngles[YAW] - vr->hmdorientation[YAW]) + vr->weaponangles[YAW];
|
||||
AnglesToAxis(angles, cg.refdef.viewaxis);
|
||||
} else {
|
||||
AnglesToAxis(cg.refdefViewAngles, cg.refdef.viewaxis);
|
||||
}
|
||||
}
|
||||
|
||||
if ( cg.hyperspace ) {
|
||||
|
|
|
@ -30,6 +30,7 @@ unsigned frame_msec;
|
|||
int old_com_frameTime;
|
||||
|
||||
extern vr_clientinfo_t vr;
|
||||
extern cvar_t *vr_refreshrate;
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
@ -602,14 +603,14 @@ void CL_FinishMove( usercmd_t *cmd ) {
|
|||
vec3_t angles;
|
||||
VectorCopy(vr.weaponangles, angles);
|
||||
|
||||
if (vr.realign_weapon)
|
||||
if (vr.realign_playspace)
|
||||
{
|
||||
VectorCopy(vr.hmdposition, vr.hmdorigin);
|
||||
vr.realign_weapon_pitch -= (cl.snap.ps.viewangles[PITCH]-vr.weaponangles[PITCH]) ;
|
||||
vr.realign_weapon = qfalse;
|
||||
vr.realign_pitch -= (cl.snap.ps.viewangles[PITCH]-vr.weaponangles[PITCH]) ;
|
||||
vr.realign_playspace = qfalse;
|
||||
}
|
||||
|
||||
angles[PITCH] += vr.realign_weapon_pitch;
|
||||
angles[PITCH] += vr.realign_pitch;
|
||||
angles[YAW] += (cl.viewangles[YAW] - vr.hmdorientation[YAW]);
|
||||
angles[ROLL] = 0; // suppress roll
|
||||
|
||||
|
@ -769,14 +770,15 @@ qboolean CL_ReadyToSendPacket( void ) {
|
|||
}
|
||||
|
||||
// check for exceeding cl_maxpackets
|
||||
if ( cl_maxpackets->integer < 15 ) {
|
||||
/* if ( cl_maxpackets->integer < 15 ) {
|
||||
Cvar_Set( "cl_maxpackets", "15" );
|
||||
} else if ( cl_maxpackets->integer > 125 ) {
|
||||
Cvar_Set( "cl_maxpackets", "125" );
|
||||
}
|
||||
*/
|
||||
oldPacketNum = (clc.netchan.outgoingSequence - 1) & PACKET_MASK;
|
||||
delta = cls.realtime - cl.outPackets[ oldPacketNum ].p_realtime;
|
||||
if ( delta < 1000 / cl_maxpackets->integer ) {
|
||||
if ( delta < 1000 / vr_refreshrate->integer ) {
|
||||
// the accumulated commands will go out in the next packet
|
||||
return qfalse;
|
||||
}
|
||||
|
|
|
@ -3544,7 +3544,7 @@ void CL_Init( void ) {
|
|||
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "140", CVAR_ARCHIVE);
|
||||
cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", 0);
|
||||
|
||||
cl_maxpackets = Cvar_Get ("cl_maxpackets", "72", CVAR_ARCHIVE );
|
||||
cl_maxpackets = Cvar_Get ("cl_maxpackets", "72", CVAR_ARCHIVE ); // NOW UNUSED
|
||||
cl_packetdup = Cvar_Get ("cl_packetdup", "1", CVAR_ARCHIVE );
|
||||
|
||||
cl_run = Cvar_Get ("cl_run", "1", CVAR_ARCHIVE);
|
||||
|
|
|
@ -36,12 +36,10 @@ float pm_stopspeed = 100.0f;
|
|||
float pm_duckScale = 0.25f;
|
||||
float pm_swimScale = 0.50f;
|
||||
|
||||
float pm_accelerate = 1000.0f;
|
||||
float pm_airaccelerate = 1.0f;
|
||||
float pm_wateraccelerate = 4.0f;
|
||||
float pm_flyaccelerate = 8.0f;
|
||||
|
||||
float pm_friction = 10.0f;
|
||||
float pm_waterfriction = 1.0f;
|
||||
float pm_flightfriction = 3.0f;
|
||||
float pm_spectatorfriction = 5.0f;
|
||||
|
@ -50,6 +48,22 @@ int c_pmove = 0;
|
|||
|
||||
extern vr_clientinfo_t *vr;
|
||||
|
||||
|
||||
float PM_GetFrictionCoefficient( void ) {
|
||||
if (vr != NULL && vr->clientNum == pm->ps->clientNum && vr->local_server) {
|
||||
return 10.0f;
|
||||
} else {
|
||||
return 6.0f;
|
||||
}
|
||||
}
|
||||
|
||||
float PM_GetAccelerationCoefficient( void ) {
|
||||
if (vr != NULL && vr->clientNum == pm->ps->clientNum && vr->local_server) {
|
||||
return 1000.0f;
|
||||
} else {
|
||||
return 10.0f;
|
||||
}
|
||||
}
|
||||
/*
|
||||
===============
|
||||
PM_AddEvent
|
||||
|
@ -199,7 +213,7 @@ static void PM_Friction( void ) {
|
|||
// if getting knocked back, no friction
|
||||
if ( ! (pm->ps->pm_flags & PMF_TIME_KNOCKBACK) ) {
|
||||
control = speed < pm_stopspeed ? pm_stopspeed : speed;
|
||||
drop += control*pm_friction*pml.frametime;
|
||||
drop += control*PM_GetFrictionCoefficient()*pml.frametime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -773,7 +787,7 @@ static void PM_WalkMove( void ) {
|
|||
if ( ( pml.groundTrace.surfaceFlags & SURF_SLICK ) || pm->ps->pm_flags & PMF_TIME_KNOCKBACK ) {
|
||||
accelerate = pm_airaccelerate;
|
||||
} else {
|
||||
accelerate = pm_accelerate;
|
||||
accelerate = PM_GetAccelerationCoefficient();
|
||||
}
|
||||
|
||||
PM_Accelerate (wishdir, wishspeed, accelerate);
|
||||
|
@ -862,7 +876,8 @@ static void PM_NoclipMove( void ) {
|
|||
{
|
||||
drop = 0;
|
||||
|
||||
friction = pm_friction*1.5; // extra friction
|
||||
friction = PM_GetFrictionCoefficient()*1.5; // extra friction
|
||||
|
||||
control = speed < pm_stopspeed ? pm_stopspeed : speed;
|
||||
drop += control*friction*pml.frametime;
|
||||
|
||||
|
@ -889,7 +904,7 @@ static void PM_NoclipMove( void ) {
|
|||
wishspeed = VectorNormalize(wishdir);
|
||||
wishspeed *= scale;
|
||||
|
||||
PM_Accelerate( wishdir, wishspeed, pm_accelerate );
|
||||
PM_Accelerate(wishdir, wishspeed, PM_GetAccelerationCoefficient());
|
||||
|
||||
// move
|
||||
VectorMA (pm->ps->origin, pml.frametime, pm->ps->velocity, pm->ps->origin);
|
||||
|
|
|
@ -405,6 +405,12 @@ extern void PlayerSettings_Cache( void );
|
|||
extern void UI_PreferencesMenu( void );
|
||||
extern void Preferences_Cache( void );
|
||||
|
||||
//
|
||||
// ui_vr.c
|
||||
//
|
||||
extern void UI_VRMenu( void );
|
||||
extern void VR_Cache( void );
|
||||
|
||||
//
|
||||
// ui_specifyleague.c
|
||||
//
|
||||
|
@ -447,6 +453,7 @@ extern void UI_GraphicsOptionsMenu( void );
|
|||
extern void GraphicsOptions_Cache( void );
|
||||
extern void DriverInfo_Cache( void );
|
||||
|
||||
|
||||
//
|
||||
// ui_players.c
|
||||
//
|
||||
|
|
|
@ -43,11 +43,12 @@ SETUP MENU
|
|||
#define ID_CUSTOMIZECONTROLS 11
|
||||
#define ID_SYSTEMCONFIG 12
|
||||
#define ID_GAME 13
|
||||
#define ID_CDKEY 14
|
||||
#define ID_LOAD 15
|
||||
#define ID_SAVE 16
|
||||
#define ID_DEFAULTS 17
|
||||
#define ID_BACK 18
|
||||
#define ID_VR 14
|
||||
#define ID_CDKEY 15
|
||||
#define ID_LOAD 16
|
||||
#define ID_SAVE 17
|
||||
#define ID_DEFAULTS 18
|
||||
#define ID_BACK 19
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -60,6 +61,7 @@ typedef struct {
|
|||
menutext_s setupcontrols;
|
||||
menutext_s setupsystem;
|
||||
menutext_s game;
|
||||
menutext_s vr;
|
||||
menutext_s cdkey;
|
||||
// menutext_s load;
|
||||
// menutext_s save;
|
||||
|
@ -123,6 +125,10 @@ static void UI_SetupMenu_Event( void *ptr, int event ) {
|
|||
UI_PreferencesMenu();
|
||||
break;
|
||||
|
||||
case ID_VR:
|
||||
UI_VRMenu();
|
||||
break;
|
||||
|
||||
case ID_CDKEY:
|
||||
UI_CDKeyMenu();
|
||||
break;
|
||||
|
@ -227,6 +233,17 @@ static void UI_SetupMenu_Init( void ) {
|
|||
setupMenuInfo.game.color = color_red;
|
||||
setupMenuInfo.game.style = UI_CENTER;
|
||||
|
||||
y += SETUP_MENU_VERTICAL_SPACING;
|
||||
setupMenuInfo.vr.generic.type = MTYPE_PTEXT;
|
||||
setupMenuInfo.vr.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
|
||||
setupMenuInfo.vr.generic.x = 320;
|
||||
setupMenuInfo.vr.generic.y = y;
|
||||
setupMenuInfo.vr.generic.id = ID_VR;
|
||||
setupMenuInfo.vr.generic.callback = UI_SetupMenu_Event;
|
||||
setupMenuInfo.vr.string = "VR OPTIONS";
|
||||
setupMenuInfo.vr.color = color_red;
|
||||
setupMenuInfo.vr.style = UI_CENTER;
|
||||
|
||||
y += SETUP_MENU_VERTICAL_SPACING;
|
||||
setupMenuInfo.cdkey.generic.type = MTYPE_PTEXT;
|
||||
setupMenuInfo.cdkey.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
|
||||
|
@ -293,6 +310,7 @@ static void UI_SetupMenu_Init( void ) {
|
|||
Menu_AddItem( &setupMenuInfo.menu, &setupMenuInfo.setupcontrols );
|
||||
Menu_AddItem( &setupMenuInfo.menu, &setupMenuInfo.setupsystem );
|
||||
Menu_AddItem( &setupMenuInfo.menu, &setupMenuInfo.game );
|
||||
Menu_AddItem( &setupMenuInfo.menu, &setupMenuInfo.vr );
|
||||
Menu_AddItem( &setupMenuInfo.menu, &setupMenuInfo.cdkey );
|
||||
// Menu_AddItem( &setupMenuInfo.menu, &setupMenuInfo.load );
|
||||
// Menu_AddItem( &setupMenuInfo.menu, &setupMenuInfo.save );
|
||||
|
|
485
code/q3_ui/ui_vr.c
Normal file
485
code/q3_ui/ui_vr.c
Normal file
|
@ -0,0 +1,485 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//
|
||||
/*
|
||||
=======================================================================
|
||||
|
||||
VR OPTIONS MENU
|
||||
|
||||
=======================================================================
|
||||
*/
|
||||
|
||||
|
||||
#include "ui_local.h"
|
||||
|
||||
|
||||
#define ART_FRAMEL "menu/art/frame2_l"
|
||||
#define ART_FRAMER "menu/art/frame1_r"
|
||||
#define ART_BACK0 "menu/art/back_0"
|
||||
#define ART_BACK1 "menu/art/back_1"
|
||||
|
||||
#define VR_X_POS 360
|
||||
|
||||
#define ID_HUDDEPTH 127
|
||||
#define ID_RIGHTHANDED 128
|
||||
#define ID_SNAPTURN 129
|
||||
#define ID_DIRECTIONMODE 130
|
||||
#define ID_JUMPTRIGGER 131
|
||||
#define ID_REFRESHRATE 132
|
||||
#define ID_WEAPONPITCH 133
|
||||
#define ID_HEIGHTADJUST 134
|
||||
#define ID_TWOHANDED 135
|
||||
#define ID_DRAWHUD 136
|
||||
#define ID_GORE 137
|
||||
|
||||
#define ID_BACK 138
|
||||
|
||||
#define NUM_HUDDEPTH 6
|
||||
#define NUM_DIRECTIONMODE 2
|
||||
#define NUM_REFRESHRATE 5
|
||||
#define NUM_GORE 4
|
||||
|
||||
|
||||
typedef struct {
|
||||
menuframework_s menu;
|
||||
|
||||
menutext_s banner;
|
||||
menubitmap_s framel;
|
||||
menubitmap_s framer;
|
||||
|
||||
menuradiobutton_s drawhud;
|
||||
menulist_s huddepth;
|
||||
menuradiobutton_s righthanded;
|
||||
menulist_s snapturn;
|
||||
menulist_s directionmode;
|
||||
menuradiobutton_s jumptrigger;
|
||||
menulist_s refreshrate;
|
||||
menuslider_s weaponpitch;
|
||||
menuslider_s heightadjust;
|
||||
menuradiobutton_s twohanded;
|
||||
menulist_s gore;
|
||||
|
||||
menubitmap_s back;
|
||||
} VR_t;
|
||||
|
||||
static VR_t s_VR;
|
||||
|
||||
|
||||
static void VR_SetMenuItems( void ) {
|
||||
s_VR.drawhud.curvalue = trap_Cvar_VariableValue( "cg_drawStatus" ) != 0;
|
||||
s_VR.huddepth.curvalue = (int)trap_Cvar_VariableValue( "vr_hudDepth" ) % NUM_HUDDEPTH;
|
||||
s_VR.righthanded.curvalue = trap_Cvar_VariableValue( "vr_righthanded" ) != 0;
|
||||
s_VR.snapturn.curvalue = (int)trap_Cvar_VariableValue( "vr_snapturn" ) / 45;
|
||||
s_VR.directionmode.curvalue = (int)trap_Cvar_VariableValue( "vr_directionMode" ) % NUM_DIRECTIONMODE;
|
||||
s_VR.jumptrigger.curvalue = trap_Cvar_VariableValue( "vr_jumpTrigger" ) != 0;
|
||||
int refresh = (int)trap_Cvar_VariableValue( "vr_refreshrate" );
|
||||
switch (refresh)
|
||||
{
|
||||
case 60:
|
||||
s_VR.refreshrate.curvalue = 0;
|
||||
break;
|
||||
case 72:
|
||||
s_VR.refreshrate.curvalue = 1;
|
||||
break;
|
||||
case 80:
|
||||
s_VR.refreshrate.curvalue = 2;
|
||||
break;
|
||||
case 90:
|
||||
s_VR.refreshrate.curvalue = 3;
|
||||
break;
|
||||
case 120:
|
||||
s_VR.refreshrate.curvalue = 4;
|
||||
break;
|
||||
}
|
||||
s_VR.weaponpitch.curvalue = trap_Cvar_VariableValue( "vr_weaponPitch" ) != 0;
|
||||
s_VR.heightadjust.curvalue = trap_Cvar_VariableValue( "vr_heightAdjust" ) != 0;
|
||||
s_VR.twohanded.curvalue = trap_Cvar_VariableValue( "vr_twoHandedWeapons" ) != 0;
|
||||
|
||||
//GORE
|
||||
{
|
||||
int level = trap_Cvar_VariableValue( "cg_gibs" ) +
|
||||
trap_Cvar_VariableValue( "com_blood" ) +
|
||||
trap_Cvar_VariableValue( "cg_megagibs" );
|
||||
|
||||
s_VR.gore.curvalue = level % NUM_GORE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void VR_Event( void* ptr, int notification ) {
|
||||
if( notification != QM_ACTIVATED ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch( ((menucommon_s*)ptr)->id ) {
|
||||
case ID_HUDDEPTH:
|
||||
trap_Cvar_SetValue( "vr_hudDepth", s_VR.huddepth.curvalue );
|
||||
break;
|
||||
|
||||
case ID_RIGHTHANDED:
|
||||
trap_Cvar_SetValue( "vr_righthanded", s_VR.righthanded.curvalue );
|
||||
break;
|
||||
|
||||
case ID_SNAPTURN:
|
||||
trap_Cvar_SetValue( "vr_snapturn", s_VR.snapturn.curvalue * 45 );
|
||||
break;
|
||||
|
||||
case ID_DIRECTIONMODE:
|
||||
trap_Cvar_SetValue( "vr_directionMode", s_VR.directionmode.curvalue );
|
||||
break;
|
||||
|
||||
case ID_JUMPTRIGGER:
|
||||
trap_Cvar_SetValue( "vr_jumpTrigger", s_VR.jumptrigger.curvalue );
|
||||
break;
|
||||
|
||||
case ID_REFRESHRATE: {
|
||||
int refresh;
|
||||
switch (s_VR.refreshrate.curvalue) {
|
||||
case 0:
|
||||
refresh = 60;
|
||||
break;
|
||||
case 1:
|
||||
refresh = 72;
|
||||
break;
|
||||
case 2:
|
||||
refresh = 80;
|
||||
break;
|
||||
case 3:
|
||||
refresh = 90;
|
||||
break;
|
||||
case 4:
|
||||
refresh = 120;
|
||||
break;
|
||||
}
|
||||
trap_Cvar_SetValue("vr_refreshrate", refresh);
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_WEAPONPITCH:
|
||||
trap_Cvar_SetValue( "vr_weaponPitch", s_VR.weaponpitch.curvalue );
|
||||
break;
|
||||
|
||||
case ID_HEIGHTADJUST:
|
||||
trap_Cvar_SetValue( "vr_heightAdjust", s_VR.heightadjust.curvalue );
|
||||
break;
|
||||
|
||||
case ID_TWOHANDED:
|
||||
trap_Cvar_SetValue( "vr_twoHandedWeapons", s_VR.twohanded.curvalue );
|
||||
break;
|
||||
|
||||
case ID_DRAWHUD:
|
||||
trap_Cvar_SetValue( "cg_drawStatus", s_VR.drawhud.curvalue );
|
||||
break;
|
||||
|
||||
case ID_GORE: {
|
||||
switch ((int)s_VR.gore.curvalue) {
|
||||
case 0:
|
||||
trap_Cvar_SetValue( "com_blood", 0);
|
||||
trap_Cvar_SetValue( "cg_gibs", 0);
|
||||
trap_Cvar_SetValue( "cg_megagibs", 0);
|
||||
break;
|
||||
case 1:
|
||||
trap_Cvar_SetValue( "com_blood", 0);
|
||||
trap_Cvar_SetValue( "cg_gibs", 1);
|
||||
trap_Cvar_SetValue( "cg_megagibs", 0);
|
||||
break;
|
||||
case 2:
|
||||
trap_Cvar_SetValue( "com_blood", 1);
|
||||
trap_Cvar_SetValue( "cg_gibs", 1);
|
||||
trap_Cvar_SetValue( "cg_megagibs", 0);
|
||||
break;
|
||||
case 3:
|
||||
trap_Cvar_SetValue( "com_blood", 1);
|
||||
trap_Cvar_SetValue( "cg_gibs", 1);
|
||||
trap_Cvar_SetValue( "cg_megagibs", 1);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_BACK:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
Controls_StatusBar
|
||||
=================
|
||||
*/
|
||||
static void VR_StatusBar( void *self )
|
||||
{
|
||||
UI_DrawString(SCREEN_WIDTH * 0.50, SCREEN_HEIGHT * 0.80, "Use Arrow Keys or CLICK to change", UI_SMALLFONT|UI_CENTER, colorWhite );
|
||||
}
|
||||
|
||||
static void VR_MenuInit( void ) {
|
||||
int y;
|
||||
|
||||
static const char *s_hud_depths[] =
|
||||
{
|
||||
"Very Close",
|
||||
"Close",
|
||||
"Middle",
|
||||
"Further",
|
||||
"Far",
|
||||
"Distant",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *s_snapturn[] =
|
||||
{
|
||||
"Smooth Turning",
|
||||
"45 Degrees",
|
||||
"90 Degrees",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *s_directionmode[] =
|
||||
{
|
||||
"HMD",
|
||||
"Off-hand Controller",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *s_refreshrate[] =
|
||||
{
|
||||
"60",
|
||||
"72",
|
||||
"80",
|
||||
"90",
|
||||
"120",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *s_gore[] =
|
||||
{
|
||||
"None",
|
||||
"Gibs Only",
|
||||
"Blood & Gibs",
|
||||
"Extra Gore",
|
||||
NULL
|
||||
};
|
||||
|
||||
memset( &s_VR, 0 ,sizeof(VR_t) );
|
||||
|
||||
VR_Cache();
|
||||
|
||||
s_VR.menu.wrapAround = qtrue;
|
||||
s_VR.menu.fullscreen = qtrue;
|
||||
|
||||
s_VR.banner.generic.type = MTYPE_BTEXT;
|
||||
s_VR.banner.generic.x = 320;
|
||||
s_VR.banner.generic.y = 16;
|
||||
s_VR.banner.string = "GAME OPTIONS";
|
||||
s_VR.banner.color = color_white;
|
||||
s_VR.banner.style = UI_CENTER;
|
||||
|
||||
s_VR.framel.generic.type = MTYPE_BITMAP;
|
||||
s_VR.framel.generic.name = ART_FRAMEL;
|
||||
s_VR.framel.generic.flags = QMF_INACTIVE;
|
||||
s_VR.framel.generic.x = 0;
|
||||
s_VR.framel.generic.y = 78;
|
||||
s_VR.framel.width = 256;
|
||||
s_VR.framel.height = 329;
|
||||
|
||||
s_VR.framer.generic.type = MTYPE_BITMAP;
|
||||
s_VR.framer.generic.name = ART_FRAMER;
|
||||
s_VR.framer.generic.flags = QMF_INACTIVE;
|
||||
s_VR.framer.generic.x = 376;
|
||||
s_VR.framer.generic.y = 76;
|
||||
s_VR.framer.width = 256;
|
||||
s_VR.framer.height = 334;
|
||||
|
||||
y = 144;
|
||||
s_VR.drawhud.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_VR.drawhud.generic.name = "Draw HUD:";
|
||||
s_VR.drawhud.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.drawhud.generic.callback = VR_Event;
|
||||
s_VR.drawhud.generic.id = ID_DRAWHUD;
|
||||
s_VR.drawhud.generic.x = VR_X_POS;
|
||||
s_VR.drawhud.generic.y = y;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.huddepth.generic.type = MTYPE_SPINCONTROL;
|
||||
s_VR.huddepth.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.huddepth.generic.x = VR_X_POS;
|
||||
s_VR.huddepth.generic.y = y;
|
||||
s_VR.huddepth.generic.name = "HUD Depth:";
|
||||
s_VR.huddepth.generic.callback = VR_Event;
|
||||
s_VR.huddepth.generic.id = ID_HUDDEPTH;
|
||||
s_VR.huddepth.itemnames = s_hud_depths;
|
||||
s_VR.huddepth.numitems = NUM_HUDDEPTH;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.righthanded.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_VR.righthanded.generic.name = "Right-Handed:";
|
||||
s_VR.righthanded.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.righthanded.generic.callback = VR_Event;
|
||||
s_VR.righthanded.generic.id = ID_RIGHTHANDED;
|
||||
s_VR.righthanded.generic.x = VR_X_POS;
|
||||
s_VR.righthanded.generic.y = y;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.snapturn.generic.type = MTYPE_SPINCONTROL;
|
||||
s_VR.snapturn.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.snapturn.generic.x = VR_X_POS;
|
||||
s_VR.snapturn.generic.y = y;
|
||||
s_VR.snapturn.generic.name = "Turning Mode:";
|
||||
s_VR.snapturn.generic.callback = VR_Event;
|
||||
s_VR.snapturn.generic.id = ID_SNAPTURN;
|
||||
s_VR.snapturn.itemnames = s_snapturn;
|
||||
s_VR.snapturn.numitems = 3;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.directionmode.generic.type = MTYPE_SPINCONTROL;
|
||||
s_VR.directionmode.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.directionmode.generic.x = VR_X_POS;
|
||||
s_VR.directionmode.generic.y = y;
|
||||
s_VR.directionmode.generic.name = "Direction Mode:";
|
||||
s_VR.directionmode.generic.callback = VR_Event;
|
||||
s_VR.directionmode.generic.id = ID_DIRECTIONMODE;
|
||||
s_VR.directionmode.itemnames = s_directionmode;
|
||||
s_VR.directionmode.numitems = NUM_DIRECTIONMODE;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.jumptrigger.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_VR.jumptrigger.generic.name = "Off-hand Trigger Jump:";
|
||||
s_VR.jumptrigger.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.jumptrigger.generic.callback = VR_Event;
|
||||
s_VR.jumptrigger.generic.id = ID_JUMPTRIGGER;
|
||||
s_VR.jumptrigger.generic.x = VR_X_POS;
|
||||
s_VR.jumptrigger.generic.y = y;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.refreshrate.generic.type = MTYPE_SPINCONTROL;
|
||||
s_VR.refreshrate.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.refreshrate.generic.x = VR_X_POS;
|
||||
s_VR.refreshrate.generic.y = y;
|
||||
s_VR.refreshrate.generic.name = "Refresh Rate:";
|
||||
s_VR.refreshrate.generic.callback = VR_Event;
|
||||
s_VR.refreshrate.generic.id = ID_REFRESHRATE;
|
||||
s_VR.refreshrate.itemnames = s_refreshrate;
|
||||
s_VR.refreshrate.numitems = NUM_REFRESHRATE;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.weaponpitch.generic.type = MTYPE_SLIDER;
|
||||
s_VR.weaponpitch.generic.x = VR_X_POS;
|
||||
s_VR.weaponpitch.generic.y = y;
|
||||
s_VR.weaponpitch.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.weaponpitch.generic.name = "Weapon Pitch:";
|
||||
s_VR.weaponpitch.generic.id = ID_WEAPONPITCH;
|
||||
s_VR.weaponpitch.generic.callback = VR_Event;
|
||||
s_VR.weaponpitch.minvalue = -25;
|
||||
s_VR.weaponpitch.maxvalue = 5;
|
||||
s_VR.weaponpitch.generic.statusbar = VR_StatusBar;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.heightadjust.generic.type = MTYPE_SLIDER;
|
||||
s_VR.heightadjust.generic.x = VR_X_POS;
|
||||
s_VR.heightadjust.generic.y = y;
|
||||
s_VR.heightadjust.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.heightadjust.generic.name = "Height Adjust:";
|
||||
s_VR.heightadjust.generic.id = ID_HEIGHTADJUST;
|
||||
s_VR.heightadjust.generic.callback = VR_Event;
|
||||
s_VR.heightadjust.minvalue = 0.0f;
|
||||
s_VR.heightadjust.maxvalue = 1.0f;
|
||||
s_VR.heightadjust.generic.statusbar = VR_StatusBar;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.twohanded.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_VR.twohanded.generic.name = "Two-Handed Weapons:";
|
||||
s_VR.twohanded.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.twohanded.generic.callback = VR_Event;
|
||||
s_VR.twohanded.generic.id = ID_TWOHANDED;
|
||||
s_VR.twohanded.generic.x = VR_X_POS;
|
||||
s_VR.twohanded.generic.y = y;
|
||||
|
||||
|
||||
y += BIGCHAR_HEIGHT + 10;
|
||||
s_VR.gore.generic.type = MTYPE_SPINCONTROL;
|
||||
s_VR.gore.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.gore.generic.x = VR_X_POS;
|
||||
s_VR.gore.generic.y = y;
|
||||
s_VR.gore.generic.name = "Gore:";
|
||||
s_VR.gore.generic.callback = VR_Event;
|
||||
s_VR.gore.generic.id = ID_GORE;
|
||||
s_VR.gore.itemnames = s_gore;
|
||||
s_VR.gore.numitems = NUM_GORE;
|
||||
|
||||
s_VR.back.generic.type = MTYPE_BITMAP;
|
||||
s_VR.back.generic.name = ART_BACK0;
|
||||
s_VR.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
||||
s_VR.back.generic.callback = VR_Event;
|
||||
s_VR.back.generic.id = ID_BACK;
|
||||
s_VR.back.generic.x = 0;
|
||||
s_VR.back.generic.y = 480-64;
|
||||
s_VR.back.width = 128;
|
||||
s_VR.back.height = 64;
|
||||
s_VR.back.focuspic = ART_BACK1;
|
||||
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.banner );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.framel );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.framer );
|
||||
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.huddepth );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.righthanded );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.snapturn );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.directionmode );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.jumptrigger );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.refreshrate );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.weaponpitch );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.heightadjust );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.twohanded );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.gore );
|
||||
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.back );
|
||||
|
||||
VR_SetMenuItems();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
VR_Cache
|
||||
===============
|
||||
*/
|
||||
void VR_Cache( void ) {
|
||||
trap_R_RegisterShaderNoMip( ART_FRAMEL );
|
||||
trap_R_RegisterShaderNoMip( ART_FRAMER );
|
||||
trap_R_RegisterShaderNoMip( ART_BACK0 );
|
||||
trap_R_RegisterShaderNoMip( ART_BACK1 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
UI_VRMenu
|
||||
===============
|
||||
*/
|
||||
void UI_VRMenu( void ) {
|
||||
VR_MenuInit();
|
||||
UI_PushMenu( &s_VR.menu );
|
||||
}
|
|
@ -37,9 +37,9 @@ int demo_protocols[] =
|
|||
#define MAX_NUM_ARGVS 50
|
||||
|
||||
#define MIN_DEDICATED_COMHUNKMEGS 1
|
||||
#define MIN_COMHUNKMEGS 128
|
||||
#define DEF_COMHUNKMEGS 256
|
||||
#define DEF_COMZONEMEGS 48
|
||||
#define MIN_COMHUNKMEGS 256
|
||||
#define DEF_COMHUNKMEGS 512
|
||||
#define DEF_COMZONEMEGS 256
|
||||
#define DEF_COMHUNKMEGS_S XSTRING(DEF_COMHUNKMEGS)
|
||||
#define DEF_COMZONEMEGS_S XSTRING(DEF_COMZONEMEGS)
|
||||
|
||||
|
@ -99,6 +99,8 @@ cvar_t *com_busyWait;
|
|||
cvar_t *con_autochat;
|
||||
#endif
|
||||
|
||||
extern cvar_t *vr_refreshrate;
|
||||
|
||||
#if idx64
|
||||
int (*Q_VMftol)(void);
|
||||
#elif id386
|
||||
|
@ -2741,7 +2743,7 @@ void Com_Init( char *commandLine ) {
|
|||
// init commands and vars
|
||||
//
|
||||
com_altivec = Cvar_Get ("com_altivec", "1", CVAR_ARCHIVE);
|
||||
com_maxfps = Cvar_Get ("com_maxfps", "72", CVAR_ARCHIVE);
|
||||
com_maxfps = Cvar_Get ("com_maxfps", "72", CVAR_ARCHIVE); // NOW UNUSED
|
||||
com_blood = Cvar_Get ("com_blood", "1", CVAR_ARCHIVE);
|
||||
|
||||
com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP );
|
||||
|
@ -2763,9 +2765,9 @@ void Com_Init( char *commandLine ) {
|
|||
com_ansiColor = Cvar_Get( "com_ansiColor", "0", CVAR_ARCHIVE );
|
||||
|
||||
com_unfocused = Cvar_Get( "com_unfocused", "0", CVAR_ROM );
|
||||
com_maxfpsUnfocused = Cvar_Get( "com_maxfpsUnfocused", "0", CVAR_ARCHIVE );
|
||||
com_maxfpsUnfocused = Cvar_Get( "com_maxfpsUnfocused", "0", CVAR_ARCHIVE ); // UNUSED
|
||||
com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM );
|
||||
com_maxfpsMinimized = Cvar_Get( "com_maxfpsMinimized", "0", CVAR_ARCHIVE );
|
||||
com_maxfpsMinimized = Cvar_Get( "com_maxfpsMinimized", "0", CVAR_ARCHIVE ); // UNUSED
|
||||
com_abnormalExit = Cvar_Get( "com_abnormalExit", "0", CVAR_ROM );
|
||||
com_busyWait = Cvar_Get("com_busyWait", "0", CVAR_ARCHIVE);
|
||||
Cvar_Get("com_errorMessage", "", CVAR_ROM | CVAR_NORESTART);
|
||||
|
@ -3104,12 +3106,16 @@ void Com_Frame( void ) {
|
|||
minMsec = SV_FrameMsec();
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
if(com_minimized->integer && com_maxfpsMinimized->integer > 0)
|
||||
minMsec = 1000 / com_maxfpsMinimized->integer;
|
||||
else if(com_unfocused->integer && com_maxfpsUnfocused->integer > 0)
|
||||
minMsec = 1000 / com_maxfpsUnfocused->integer;
|
||||
else if(com_maxfps->integer > 0)
|
||||
minMsec = 1000 / com_maxfps->integer;
|
||||
else
|
||||
*/
|
||||
if(vr_refreshrate->integer > 0)
|
||||
minMsec = 1000 / vr_refreshrate->integer;
|
||||
else
|
||||
minMsec = 1;
|
||||
|
||||
|
|
|
@ -3042,13 +3042,13 @@ static void UI_Update(const char *name) {
|
|||
} else if (Q_stricmp(name, "ui_setRate") == 0) {
|
||||
float rate = trap_Cvar_VariableValue("rate");
|
||||
if (rate >= 5000) {
|
||||
trap_Cvar_Set("cl_maxpackets", "30");
|
||||
// trap_Cvar_Set("cl_maxpackets", "30");
|
||||
trap_Cvar_Set("cl_packetdup", "1");
|
||||
} else if (rate >= 4000) {
|
||||
trap_Cvar_Set("cl_maxpackets", "15");
|
||||
// trap_Cvar_Set("cl_maxpackets", "15");
|
||||
trap_Cvar_Set("cl_packetdup", "2"); // favor less prediction errors when there's packet loss
|
||||
} else {
|
||||
trap_Cvar_Set("cl_maxpackets", "15");
|
||||
// trap_Cvar_Set("cl_maxpackets", "15");
|
||||
trap_Cvar_Set("cl_packetdup", "1"); // favor lower bandwidth
|
||||
}
|
||||
} else if (Q_stricmp(name, "ui_GetName") == 0) {
|
||||
|
|
|
@ -27,6 +27,9 @@ cvar_t *vr_extralatencymode = NULL;
|
|||
cvar_t *vr_directionMode = NULL;
|
||||
cvar_t *vr_weaponPitch = NULL;
|
||||
cvar_t *vr_twoHandedWeapons = NULL;
|
||||
cvar_t *vr_refreshrate = NULL;
|
||||
cvar_t *vr_weaponZoom = NULL;
|
||||
cvar_t *vr_jumpTrigger = NULL;
|
||||
|
||||
engine_t* VR_Init( ovrJava java )
|
||||
{
|
||||
|
@ -55,6 +58,9 @@ void VR_InitCvars( void )
|
|||
vr_weaponPitch = Cvar_Get ("vr_weaponPitch", "-20", CVAR_ARCHIVE);
|
||||
vr_heightAdjust = Cvar_Get ("vr_heightAdjust", "0.0", CVAR_ARCHIVE);
|
||||
vr_twoHandedWeapons = Cvar_Get ("vr_twoHandedWeapons", "1", CVAR_ARCHIVE);
|
||||
vr_refreshrate = Cvar_Get ("vr_refreshrate", "0", CVAR_ARCHIVE);
|
||||
vr_weaponZoom = Cvar_Get ("vr_weaponZoom", "0", CVAR_ARCHIVE);
|
||||
vr_jumpTrigger = Cvar_Get ("vr_jumpTrigger", "1", CVAR_ARCHIVE);
|
||||
|
||||
// Values are: scale,right,up,forward,pitch,yaw,roll
|
||||
// VALUES PROVIDED BY SkillFur - Thank-you!
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
|
||||
typedef struct {
|
||||
qboolean weapon_stabilised;
|
||||
qboolean weapon_zoomed;
|
||||
float weapon_zoomLevel;
|
||||
qboolean right_handed;
|
||||
qboolean virtual_screen;
|
||||
qboolean local_server; // used in bg_pmove.c
|
||||
|
||||
qboolean realign_weapon; // used to realign the weapon in a multiplayer game
|
||||
int realign_weapon_pitch; // used to realign the weapon pitch in a multiplayer game
|
||||
qboolean realign_playspace; // used to realign the weapon in a multiplayer game
|
||||
int realign_pitch; // used to realign the weapon pitch in a multiplayer game
|
||||
|
||||
int clientNum;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "vr_clientinfo.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <jni.h>
|
||||
|
||||
#ifdef USE_LOCAL_HEADERS
|
||||
# include "SDL.h"
|
||||
|
@ -68,6 +69,10 @@ extern cvar_t *vr_directionMode;
|
|||
extern cvar_t *vr_weaponPitch;
|
||||
extern cvar_t *vr_heightAdjust;
|
||||
extern cvar_t *vr_twoHandedWeapons;
|
||||
extern cvar_t *vr_refreshrate;
|
||||
extern cvar_t *vr_weaponZoom;
|
||||
extern cvar_t *vr_jumpTrigger;
|
||||
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out)
|
||||
{
|
||||
|
@ -218,7 +223,6 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
|
|||
vr.weaponoffset[1] = vr.weaponposition[1] - vr.hmdposition[1];
|
||||
vr.weaponoffset[2] = vr.weaponposition[2] - vr.hmdposition[2];
|
||||
|
||||
|
||||
if (vr.virtual_screen ||
|
||||
cl.snap.ps.pm_type == PM_INTERMISSION)
|
||||
{
|
||||
|
@ -240,11 +244,17 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
|
|||
vr.offhandoffset[2] = vr.offhandposition[2] - vr.hmdposition[2];
|
||||
}
|
||||
|
||||
vr.weapon_zoomed = vr_weaponZoom->integer &&
|
||||
vr.weapon_stabilised &&
|
||||
(cl.snap.ps.weapon == WP_RAILGUN) &&
|
||||
(VectorLength(vr.weaponoffset) < 0.3f) &&
|
||||
cl.snap.ps.stats[STAT_HEALTH] > 0;
|
||||
|
||||
if (vr_twoHandedWeapons->integer && vr.weapon_stabilised)
|
||||
{
|
||||
float x = vr.offhandoffset[0] - vr.weaponoffset[0];
|
||||
float y = vr.offhandoffset[1] - vr.weaponoffset[1];
|
||||
float z = vr.offhandoffset[2] - vr.weaponoffset[2];
|
||||
float x = vr.offhandoffset[0] - (vr.weapon_zoomed ? 0 : vr.weaponoffset[0]);
|
||||
float y = vr.offhandoffset[1] - (vr.weapon_zoomed ? 0 : vr.weaponoffset[1]);
|
||||
float z = vr.offhandoffset[2] - (vr.weapon_zoomed ? 0 : vr.weaponoffset[2]);
|
||||
float zxDist = length(x, z);
|
||||
|
||||
if (zxDist != 0.0f && z != 0.0f) {
|
||||
|
@ -252,6 +262,7 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
|
|||
-degrees(atan2f(x, -z)), vr.weaponangles[ROLL] / 2.0f); //Dampen roll on stabilised weapon
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void IN_VRJoystick( qboolean isRightController, float joystickX, float joystickY )
|
||||
|
@ -375,18 +386,30 @@ static void IN_VRTriggers( qboolean isRightController, float index ) {
|
|||
}
|
||||
}
|
||||
|
||||
//off hand trigger Jump as well
|
||||
if (isRightController != (vr_righthanded->integer != 0)) {
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) && index > pressedThreshold) {
|
||||
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_SPACE, qtrue, 0, NULL);
|
||||
} else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) && index < releasedThreshold) {
|
||||
controller->axisButtons &= ~VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_SPACE, qfalse, 0, NULL);
|
||||
}
|
||||
}
|
||||
//off hand trigger Jump as well - if configured
|
||||
if (vr_jumpTrigger->integer) {
|
||||
if (isRightController != (vr_righthanded->integer != 0)) {
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index > pressedThreshold) {
|
||||
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_SPACE, qtrue, 0, NULL);
|
||||
} else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index < releasedThreshold) {
|
||||
controller->axisButtons &= ~VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_SPACE, qfalse, 0, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void jni_showkeyboard( void )
|
||||
{
|
||||
jclass callbackClass = (*VR_GetEngine()->java.Env)->GetObjectClass(VR_GetEngine()->java.Env, VR_GetEngine()->java.ActivityObject);
|
||||
jmethodID android_showkeyboard = (*VR_GetEngine()->java.Env)->GetMethodID(VR_GetEngine()->java.Env, callbackClass, "showkeyboard","()V");
|
||||
return (*(VR_GetEngine()->java.Env))->CallVoidMethod(VR_GetEngine()->java.Env, VR_GetEngine()->java.ActivityObject, android_showkeyboard);
|
||||
}
|
||||
|
||||
|
||||
static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
|
||||
{
|
||||
vrController_t* controller = isRightController == qtrue ? &rightController : &leftController;
|
||||
|
@ -466,7 +489,8 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
|
|||
// Y button - unassigned right now
|
||||
if ((buttons & ovrButton_Y) && !(controller->buttons & ovrButton_Y)) {
|
||||
//Actually want this to reset the player location
|
||||
vr.realign_weapon = qtrue;
|
||||
//jni_showkeyboard();
|
||||
vr.realign_playspace = qtrue;
|
||||
} else if (!(buttons & ovrButton_Y) && (controller->buttons & ovrButton_Y)) {
|
||||
}
|
||||
|
||||
|
@ -493,6 +517,11 @@ void IN_VRInputFrame( void )
|
|||
assert(result == VRAPI_INITIALIZE_SUCCESS);
|
||||
}
|
||||
|
||||
if (vr_refreshrate != NULL && vr_refreshrate->integer)
|
||||
{
|
||||
vrapi_SetDisplayRefreshRate(VR_GetEngine()->ovr, (float)vr_refreshrate->integer);
|
||||
}
|
||||
|
||||
result = vrapi_SetClockLevels(VR_GetEngine()->ovr, 4, 4);
|
||||
assert(result == VRAPI_INITIALIZE_SUCCESS);
|
||||
|
||||
|
|
|
@ -247,8 +247,21 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
|
||||
float fov_y = vrapi_GetSystemPropertyInt( engine->ovr, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_Y);
|
||||
float fov_x = vrapi_GetSystemPropertyInt( engine->ovr, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
|
||||
|
||||
if (vr.weapon_zoomed) {
|
||||
vr.weapon_zoomLevel += 0.05;
|
||||
if (vr.weapon_zoomLevel > 2.5f)
|
||||
vr.weapon_zoomLevel = 2.5f;
|
||||
}
|
||||
else {
|
||||
//Zoom back out quicker
|
||||
vr.weapon_zoomLevel -= 0.1;
|
||||
if (vr.weapon_zoomLevel < 1.0f)
|
||||
vr.weapon_zoomLevel = 1.0f;
|
||||
}
|
||||
|
||||
const ovrMatrix4f projectionMatrix = ovrMatrix4f_CreateProjectionFov(
|
||||
fov_x, fov_y, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
fov_x / vr.weapon_zoomLevel, fov_y / vr.weapon_zoomLevel, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
|
||||
static float playerYaw = 0;
|
||||
|
||||
|
@ -299,11 +312,15 @@ void VR_DrawFrame( engine_t* engine ) {
|
|||
|
||||
ovrLayerProjection2 layer = vrapi_DefaultLayerProjection2();
|
||||
layer.HeadPose = engine->tracking.HeadPose;
|
||||
|
||||
for (int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; ++eye) {
|
||||
|
||||
const ovrMatrix4f defaultProjection = ovrMatrix4f_CreateProjectionFov(
|
||||
fov_x, fov_y, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
|
||||
|
||||
for (int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; ++eye) {
|
||||
layer.Textures[eye].ColorSwapChain = engine->framebuffers[eye].colorTexture;
|
||||
layer.Textures[eye].SwapChainIndex = engine->framebuffers[eye].swapchainIndex;
|
||||
layer.Textures[eye].TexCoordsFromTanAngles = ovrMatrix4f_TanAngleMatrixFromProjection(&projectionMatrix);
|
||||
layer.Textures[eye].TexCoordsFromTanAngles = ovrMatrix4f_TanAngleMatrixFromProjection(&defaultProjection);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue