This commit is contained in:
Simon 2022-03-15 22:38:32 +00:00
commit b6896417cf
17 changed files with 394 additions and 231 deletions

View file

@ -2668,7 +2668,7 @@ Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm)
$(B)/$(BASEGAME)/ui$(SHLIBNAME): $(Q3UIOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ) $(CLIENT_LIBS)
$(B)/$(BASEGAME)/vm/ui.qvm: $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM)
$(echo_cmd) "Q3ASM $@"

View file

@ -22,7 +22,8 @@ BUILD_MISSIONPACK=1
BUILD_SERVER=0
BUILD_STANDALONE=0
GENERATE_DEPENDENCIES=0
USE_CODEC_VORBIS=0
USE_INTERNAL_OGG=1
USE_CODEC_VORBIS=1
USE_CURL=0
USE_CURL_DLOPEN=0
USE_INTERNAL_SPEEX=0

View file

@ -5,6 +5,7 @@
android:versionCode="34"
android:versionName="0.23.0">
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
<uses-feature android:name="oculus.software.overlay_keyboard" android:required="false"/>
<uses-feature android:glEsVersion="0x00030001" />
<!-- <uses-feature android:name="oculus.software.overlay_keyboard" android:required="false"/>-->

View file

@ -2618,9 +2618,9 @@ static void CG_DrawVignette( void )
if (currentComfortVignetteValue > 0.0f && currentComfortVignetteValue <= 1.0f && !(vr->weapon_zoomed))
{
int x = (int)(0 + currentComfortVignetteValue * cg.refdef.width / 3);
int x = (int)(0 + currentComfortVignetteValue * cg.refdef.width / 3.5f);
int w = (int)(cg.refdef.width - 2 * x);
int y = (int)(0 + currentComfortVignetteValue * cg.refdef.height / 3);
int y = (int)(0 + currentComfortVignetteValue * cg.refdef.height / 3.5f);
int h = (int)(cg.refdef.height - 2 * y);
// sides
@ -2678,6 +2678,11 @@ static void CG_Draw2D(stereoFrame_t stereoFrame)
CG_DrawVignette();
// If weapon selector is active, check whether draw HUD
if (cg.weaponSelectorTime != 0 && trap_Cvar_VariableValue("vr_weaponSelectorWithHud") == 0) {
return;
}
#ifdef MISSIONPACK
if ( cg_drawStatus.integer ) {
Menu_PaintAll();
@ -2841,13 +2846,9 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
VectorCopy( baseOrg, cg.refdef.vieworg );
//Don't draw HUD whilst selecting the weapon with the holster (it gets in the way)
if (cg.weaponSelectorTime == 0)
{
// draw status bar and other floating elements
hudStereoView = stereoView;
CG_Draw2D(hudStereoView);
}
// draw status bar and other floating elements
hudStereoView = stereoView;
CG_Draw2D(hudStereoView);
}

View file

@ -2087,7 +2087,8 @@ void CG_DrawWeaponSelector( void )
}
else
{
VectorMA(holsterOrigin, -3.0f, holsterUp, holsterOrigin);
// Do not shift weapon wheel down in order to fit inside comfort vignette
//VectorMA(holsterOrigin, -3.0f, holsterUp, holsterOrigin);
}
VectorCopy(holsterOrigin, beamOrigin);

View file

@ -155,8 +155,8 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
switch (s_controls3.controlschema.curvalue)
{
case 0: // Default schema
trap_Cvar_Set("vr_button_map_RTHUMBLEFT", ""); // empty ~ turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT", ""); // empty ~ turn right
trap_Cvar_Set("vr_button_map_RTHUMBLEFT", "turnleft"); // turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT", "turnright"); // turn right
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", "weapnext"); // next weapon
if (s_controls3.uturn.curvalue) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "uturn"); // u-turn
@ -190,18 +190,18 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT", "+weapon_select");
trap_Cvar_Set("vr_button_map_PRIMARYTHUMBSTICK", "+weapon_select");
trap_Cvar_Set("vr_button_map_PRIMARYGRIP", "+alt"); // switch to alt layout
trap_Cvar_Set("vr_button_map_RTHUMBLEFT_ALT", ""); // empty ~ turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT_ALT", ""); // empty ~ turn right
trap_Cvar_Set("vr_button_map_RTHUMBLEFT_ALT", "turnleft"); // turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT_ALT", "turnright"); // turn right
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD_ALT", "weapnext");
if (s_controls3.uturn.curvalue) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "uturn");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "weapprev");
}
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDRIGHT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKRIGHT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKLEFT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDRIGHT_ALT", "blank"); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKRIGHT_ALT", "blank"); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKLEFT_ALT", "blank"); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT_ALT", "blank"); // unmapped
break;
}
}

View file

@ -55,7 +55,8 @@ GAME OPTIONS MENU
#define ID_HOLSTER2D 140
#define ID_GORE 141
#define ID_SHOWINHAND 142
#define ID_BACK 143
#define ID_SELECTORWITHHUD 143
#define ID_BACK 144
#define NUM_CROSSHAIRS 10
#define NUM_GORE 4
@ -84,6 +85,7 @@ typedef struct {
menuradiobutton_s holster2d;
menulist_s gore;
menuradiobutton_s showinhand;
menuradiobutton_s selectorwithhud;
menubitmap_s back;
qhandle_t crosshairShader[NUM_CROSSHAIRS];
@ -133,6 +135,7 @@ static void Preferences_SetMenuItems( void ) {
s_preferences.gore.curvalue = level % NUM_GORE;
}
s_preferences.showinhand.curvalue = trap_Cvar_VariableValue( "vr_showItemInHand" ) != 0;
s_preferences.selectorwithhud.curvalue = trap_Cvar_VariableValue( "vr_weaponSelectorWithHud" ) != 0;
}
@ -232,6 +235,10 @@ static void Preferences_Event( void* ptr, int notification ) {
trap_Cvar_SetValue( "vr_showItemInHand", s_preferences.showinhand.curvalue);
break;
case ID_SELECTORWITHHUD:
trap_Cvar_SetValue( "vr_weaponSelectorWithHud", s_preferences.selectorwithhud.curvalue);
break;
case ID_BACK:
UI_PopMenu();
break;
@ -321,7 +328,7 @@ static void Preferences_MenuInit( void ) {
s_preferences.framer.width = 256;
s_preferences.framer.height = 334;
y = 110;
y = 92;
s_preferences.crosshair.generic.type = MTYPE_SPINCONTROL;
s_preferences.crosshair.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT|QMF_NODEFAULTINIT|QMF_OWNERDRAW;
s_preferences.crosshair.generic.x = PREFERENCES_X_POS;
@ -454,6 +461,15 @@ static void Preferences_MenuInit( void ) {
s_preferences.drawhud.generic.x = PREFERENCES_X_POS;
s_preferences.drawhud.generic.y = y;
y += BIGCHAR_HEIGHT+2;
s_preferences.selectorwithhud.generic.type = MTYPE_RADIOBUTTON;
s_preferences.selectorwithhud.generic.name = "Draw HUD On Weapon Selector:";
s_preferences.selectorwithhud.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_preferences.selectorwithhud.generic.callback = Preferences_Event;
s_preferences.selectorwithhud.generic.id = ID_SELECTORWITHHUD;
s_preferences.selectorwithhud.generic.x = PREFERENCES_X_POS;
s_preferences.selectorwithhud.generic.y = y;
// y += BIGCHAR_HEIGHT+2;
// s_preferences.allowdownload.generic.type = MTYPE_RADIOBUTTON;
// s_preferences.allowdownload.generic.name = "Automatic Downloading:";
@ -505,6 +521,7 @@ static void Preferences_MenuInit( void ) {
// Menu_AddItem( &s_preferences.menu, &s_preferences.allowdownload );
Menu_AddItem( &s_preferences.menu, &s_preferences.gore );
Menu_AddItem( &s_preferences.menu, &s_preferences.showinhand );
Menu_AddItem( &s_preferences.menu, &s_preferences.selectorwithhud );
Menu_AddItem( &s_preferences.menu, &s_preferences.back );

View file

@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Quake's menu framework system.
**********************************************************************/
#include "ui_local.h"
#include "SDL.h"
sfxHandle_t menu_in_sound;
sfxHandle_t menu_move_sound;
@ -1653,6 +1654,18 @@ sfxHandle_t Menu_DefaultKey( menuframework_s *m, int key )
case MTYPE_FIELD:
sound = MenuField_Key( (menufield_s*)item, &key );
#if __ANDROID__
//show virtual keyboard
menufield_s* m = (menufield_s*)item;
if ( key == 178 )
{
//delete value on click
sprintf( m->field.buffer, "" );
}
m->field.cursor = strlen( m->field.buffer );
SDL_StartTextInput();
#endif
break;
}

View file

@ -1246,8 +1246,6 @@ void IN_Init( void *windowData )
in_joystick = Cvar_Get( "in_joystick", "0", CVAR_ARCHIVE|CVAR_LATCH );
in_joystickThreshold = Cvar_Get( "joy_threshold", "0.15", CVAR_ARCHIVE );
SDL_StartTextInput( );
mouseAvailable = ( in_mouse->value != 0 );
IN_DeactivateMouse( Cvar_VariableIntegerValue( "r_fullscreen" ) != 0 );

View file

@ -37,6 +37,7 @@ cvar_t *vr_lasersight = NULL;
cvar_t *vr_hapticIntensity = NULL;
cvar_t *vr_comfortVignette = NULL;
cvar_t *vr_weaponSelectorMode = NULL;
cvar_t *vr_weaponSelectorWithHud = NULL;
engine_t* VR_Init( ovrJava java )
{
@ -75,6 +76,7 @@ void VR_InitCvars( void )
vr_hapticIntensity = Cvar_Get ("vr_hapticIntensity", "1.0", CVAR_ARCHIVE);
vr_comfortVignette = Cvar_Get ("vr_comfortVignette", "0.0", CVAR_ARCHIVE);
vr_weaponSelectorMode = Cvar_Get ("vr_weaponSelectorMode", "0", CVAR_ARCHIVE);
vr_weaponSelectorWithHud = Cvar_Get ("vr_weaponSelectorWithHud", "0", CVAR_ARCHIVE);
// Values are: scale,right,up,forward,pitch,yaw,roll
// VALUES PROVIDED BY SkillFur - Thank-you!
@ -99,8 +101,8 @@ void VR_InitCvars( void )
qboolean uturnEnabled = Cvar_VariableValue( "vr_uturn" ) != 0;
int controlSchema = (int)Cvar_VariableValue( "vr_controlSchema" ) % 2;
if (controlSchema == 0) {
Cvar_Get ("vr_button_map_RTHUMBLEFT", "", CVAR_ARCHIVE); // empty ~ turn left
Cvar_Get ("vr_button_map_RTHUMBRIGHT", "", CVAR_ARCHIVE); // empty ~ turn right
Cvar_Get ("vr_button_map_RTHUMBLEFT", "turnleft", CVAR_ARCHIVE); // turn left
Cvar_Get ("vr_button_map_RTHUMBRIGHT", "turnright", CVAR_ARCHIVE); // turn right
Cvar_Get ("vr_button_map_RTHUMBFORWARD", "weapnext", CVAR_ARCHIVE); // next weapon
if (uturnEnabled) {
Cvar_Get ("vr_button_map_RTHUMBBACK", "uturn", CVAR_ARCHIVE); // u-turn
@ -133,18 +135,18 @@ void VR_InitCvars( void )
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT", "+weapon_select", CVAR_ARCHIVE);
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK", "+weapon_select", CVAR_ARCHIVE);
Cvar_Get ("vr_button_map_PRIMARYGRIP", "+alt", CVAR_ARCHIVE); // switch to alt layout
Cvar_Get ("vr_button_map_RTHUMBLEFT_ALT", "", CVAR_ARCHIVE); // empty ~ turn left
Cvar_Get ("vr_button_map_RTHUMBRIGHT_ALT", "", CVAR_ARCHIVE); // empty ~ turn right
Cvar_Get ("vr_button_map_RTHUMBLEFT_ALT", "turnleft", CVAR_ARCHIVE); // turn left
Cvar_Get ("vr_button_map_RTHUMBRIGHT_ALT", "turnright", CVAR_ARCHIVE); // turn right
Cvar_Get ("vr_button_map_RTHUMBFORWARD_ALT", "weapnext", CVAR_ARCHIVE);
if (uturnEnabled) {
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "uturn", CVAR_ARCHIVE);
} else {
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "weapprev", CVAR_ARCHIVE);
}
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT_ALT", "blank", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT_ALT", "blank", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT_ALT", "blank", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT_ALT", "blank", CVAR_ARCHIVE); // unmapped
}
//Remaining button mapping (buttons not affected by schemas)

View file

@ -243,12 +243,16 @@ static void VR_processHaptics() {
}
}
static void IN_SendButtonAction(const char* action, qboolean pressed, qboolean isThumbstickAxis)
// Returns true in case button press should be auto-repeated when holding (now only applicable for smooth-turn)
static qboolean IN_SendButtonAction(const char* action, qboolean pressed, qboolean isThumbstickAxis, float axisValue)
{
if (action)
{
//handle our special actions first
if (strcmp(action, "+alt") == 0)
if (strcmp(action, "blank") == 0) {
// empty function to block alt fallback on unmapped alt buttons
}
else if (strcmp(action, "+alt") == 0)
{
alt_key_mode_active = pressed;
}
@ -279,7 +283,41 @@ static void IN_SendButtonAction(const char* action, qboolean pressed, qboolean i
}
else if (pressed)
{
if (strcmp(action, "uturn") == 0) {
if (strcmp(action, "turnleft") == 0) {
if (vr_snapturn->integer > 0) { // snap turn
int snap = 45;
if (vr_snapturn->integer > 1) {
snap = vr_snapturn->integer;
}
CL_SnapTurn(-snap);
} else { // yaw (smooth turn)
// TODO How to disable this once enabled?
// (In this method i do not know to which button it is assigned and
// since i need to invoke the button repeatedly, i will not receive
// the "pressed=false" event)
// vr.smooth_turning = true;
float value = (isThumbstickAxis ? axisValue : 1.0f) * cl_sensitivity->value * m_yaw->value;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, -value, 0, 0, NULL);
return qtrue;
}
} else if (strcmp(action, "turnright") == 0) {
if (vr_snapturn->integer > 0) { // snap turn
int snap = 45;
if (vr_snapturn->integer > 1) {
snap = vr_snapturn->integer;
}
CL_SnapTurn(snap);
} else { // yaw (smooth turn)
// TODO How to disable this once enabled?
// (In this method i do not know to which button it is assigned and
// since i need to invoke the button repeatedly, i will not receive
// the "pressed=false" event)
// vr.smooth_turning = true;
float value = (isThumbstickAxis ? axisValue : 1.0f) * cl_sensitivity->value * m_yaw->value;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, value, 0, 0, NULL);
return qtrue;
}
} else if (strcmp(action, "uturn") == 0) {
CL_SnapTurn(180);
} else {
char command[256];
@ -288,6 +326,7 @@ static void IN_SendButtonAction(const char* action, qboolean pressed, qboolean i
}
}
}
return qfalse;
}
void VR_HapticEvent(const char* event, int position, int flags, int intensity, float angle, float yHeight )
@ -351,25 +390,21 @@ void VR_HapticEvent(const char* event, int position, int flags, int intensity, f
static qboolean IN_GetButtonAction(const char* button, char* action)
{
char cvarname[256];
if (alt_key_mode_active) {
Com_sprintf(cvarname, 256, "vr_button_map_%s_ALT", button);
} else {
Com_sprintf(cvarname, 256, "vr_button_map_%s", button);
}
Com_sprintf(cvarname, 256, "vr_button_map_%s%s", button, alt_key_mode_active ? "_ALT" : "");
char * val = Cvar_VariableString(cvarname);
if (val && strlen(val) > 0)
{
Com_sprintf(action, 256, "%s", val);
return qtrue;
}
else if (alt_key_mode_active)
//If we didn't find something for this button and the alt key is active, then see if the un-alt key has a function
if (alt_key_mode_active)
{
// No action found for buttom ALT mapping. Check if we are not
// holding ALT key itself (there is no ALT function for ALT)
Com_sprintf(cvarname, 256, "vr_button_map_%s", button);
char * val = Cvar_VariableString(cvarname);
if (val && strcmp(val, "+alt") == 0) {
if (val && strlen(val) > 0)
{
Com_sprintf(action, 256, "%s", val);
return qtrue;
}
@ -417,7 +452,11 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
cl.snap.ps.pm_type == PM_INTERMISSION)
{
int mouse_multiplier = 10;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, vr.weaponangles_delta[YAW] * mouse_multiplier, -vr.weaponangles_delta[PITCH] * mouse_multiplier, 0, NULL);
//ignore cursor jumping when e.g. showing keyboard
if ( ( fabs(vr.weaponangles_delta[ YAW ]) < 10 ) && ( fabs(vr.weaponangles_delta[ PITCH ]) < 10 ) )
{
Com_QueueEvent(in_vrEventTime, SE_MOUSE, vr.weaponangles_delta[YAW] * mouse_multiplier, -vr.weaponangles_delta[PITCH] * mouse_multiplier, 0, NULL);
}
}
} else {
vec3_t rotation = {0};
@ -524,18 +563,18 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
}
else if (!vr.weapon_select) //right controller
{
float absoluteAxisValue = sqrt(joystickY*joystickY + joystickX*joystickX);
// up, up-left, up-right (use release threshold to be more sensitive)
if (joystickY > releasedThreshold) {
// stop left & right
vr.smooth_turning = false;
if ((controller->axisButtons & VR_TOUCH_AXIS_LEFT) && IN_GetButtonAction("RTHUMBLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
if ((controller->axisButtons & VR_TOUCH_AXIS_RIGHT) && IN_GetButtonAction("RTHUMBRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
@ -543,19 +582,22 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
if (joystickX < -releasedThreshold) {
// stop up
if ((controller->axisButtons & VR_TOUCH_AXIS_UP) && IN_GetButtonAction("RTHUMBFORWARD", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UP;
// stop up-right
if ((controller->axisButtons & VR_TOUCH_AXIS_UPRIGHT) && IN_GetButtonAction("RTHUMBFORWARDRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UPRIGHT;
// start up-left
if (!(controller->axisButtons & VR_TOUCH_AXIS_UPLEFT)) {
controller->axisButtons |= VR_TOUCH_AXIS_UPLEFT;
if (IN_GetButtonAction("RTHUMBFORWARDLEFT", action)) {
IN_SendButtonAction(action, qtrue, qtrue);
if (!IN_SendButtonAction(action, qtrue, qtrue, absoluteAxisValue)) {
controller->axisButtons |= VR_TOUCH_AXIS_UPLEFT;
};
} else {
controller->axisButtons |= VR_TOUCH_AXIS_UPLEFT;
}
}
@ -563,19 +605,22 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
} else if (joystickX > releasedThreshold) {
// stop up
if ((controller->axisButtons & VR_TOUCH_AXIS_UP) && IN_GetButtonAction("RTHUMBFORWARD", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UP;
// stop up-left
if ((controller->axisButtons & VR_TOUCH_AXIS_UPLEFT) && IN_GetButtonAction("RTHUMBFORWARDLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UPLEFT;
// start up-right
if (!(controller->axisButtons & VR_TOUCH_AXIS_UPRIGHT)) {
controller->axisButtons |= VR_TOUCH_AXIS_UPRIGHT;
if (IN_GetButtonAction("RTHUMBFORWARDRIGHT", action)) {
IN_SendButtonAction(action, qtrue, qtrue);
if (!IN_SendButtonAction(action, qtrue, qtrue, absoluteAxisValue)) {
controller->axisButtons |= VR_TOUCH_AXIS_UPRIGHT;
}
} else {
controller->axisButtons |= VR_TOUCH_AXIS_UPRIGHT;
}
}
@ -583,19 +628,22 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
} else {
// stop up-left
if ((controller->axisButtons & VR_TOUCH_AXIS_UPLEFT) && IN_GetButtonAction("RTHUMBFORWARDLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UPLEFT;
// stop up-right
if ((controller->axisButtons & VR_TOUCH_AXIS_UPRIGHT) && IN_GetButtonAction("RTHUMBFORWARDRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UPRIGHT;
// start up
if (!(controller->axisButtons & VR_TOUCH_AXIS_UP) && joystickY > pressedThreshold) {
controller->axisButtons |= VR_TOUCH_AXIS_UP;
if (IN_GetButtonAction("RTHUMBFORWARD", action)) {
IN_SendButtonAction(action, qtrue, qtrue);
if (!IN_SendButtonAction(action, qtrue, qtrue, absoluteAxisValue)) {
controller->axisButtons |= VR_TOUCH_AXIS_UP;
}
} else {
controller->axisButtons |= VR_TOUCH_AXIS_UP;
}
}
}
@ -604,13 +652,12 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
} else if (joystickY < -releasedThreshold) {
// stop left & right
vr.smooth_turning = false;
if ((controller->axisButtons & VR_TOUCH_AXIS_LEFT) && IN_GetButtonAction("RTHUMBLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
if ((controller->axisButtons & VR_TOUCH_AXIS_RIGHT) && IN_GetButtonAction("RTHUMBRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
@ -618,19 +665,22 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
if (joystickX < -releasedThreshold) {
// stop down
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWN) && IN_GetButtonAction("RTHUMBBACK", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWN;
// stop down-right
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWNRIGHT) && IN_GetButtonAction("RTHUMBBACKRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWNRIGHT;
// start down-left
if (!(controller->axisButtons & VR_TOUCH_AXIS_DOWNLEFT)) {
controller->axisButtons |= VR_TOUCH_AXIS_DOWNLEFT;
if (IN_GetButtonAction("RTHUMBBACKLEFT", action)) {
IN_SendButtonAction(action, qtrue, qtrue);
if (!IN_SendButtonAction(action, qtrue, qtrue, absoluteAxisValue)) {
controller->axisButtons |= VR_TOUCH_AXIS_DOWNLEFT;
}
} else {
controller->axisButtons |= VR_TOUCH_AXIS_DOWNLEFT;
}
}
@ -638,19 +688,22 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
} else if (joystickX > releasedThreshold) {
// stop down
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWN) && IN_GetButtonAction("RTHUMBBACK", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWN;
// stop down-left
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWNLEFT) && IN_GetButtonAction("RTHUMBBACKLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWNLEFT;
// start down-right
if (!(controller->axisButtons & VR_TOUCH_AXIS_DOWNRIGHT)) {
controller->axisButtons |= VR_TOUCH_AXIS_DOWNRIGHT;
if (IN_GetButtonAction("RTHUMBBACKRIGHT", action)) {
IN_SendButtonAction(action, qtrue, qtrue);
if (!IN_SendButtonAction(action, qtrue, qtrue, absoluteAxisValue)) {
controller->axisButtons |= VR_TOUCH_AXIS_DOWNRIGHT;
}
} else {
controller->axisButtons |= VR_TOUCH_AXIS_DOWNRIGHT;
}
}
@ -658,19 +711,22 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
} else {
// stop down-left
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWNLEFT) && IN_GetButtonAction("RTHUMBBACKLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWNLEFT;
// stop down-right
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWNRIGHT) && IN_GetButtonAction("RTHUMBBACKRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWNRIGHT;
// start down
if (!(controller->axisButtons & VR_TOUCH_AXIS_DOWN) && joystickY < -pressedThreshold) {
controller->axisButtons |= VR_TOUCH_AXIS_DOWN;
if (IN_GetButtonAction("RTHUMBBACK", action)) {
IN_SendButtonAction(action, qtrue, qtrue);
if (!IN_SendButtonAction(action, qtrue, qtrue, absoluteAxisValue)) {
controller->axisButtons |= VR_TOUCH_AXIS_DOWN;
}
} else {
controller->axisButtons |= VR_TOUCH_AXIS_DOWN;
}
}
}
@ -680,113 +736,67 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
// stop up-left
if ((controller->axisButtons & VR_TOUCH_AXIS_UPLEFT) && IN_GetButtonAction("RTHUMBFORWARDLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UPLEFT;
// stop up
if ((controller->axisButtons & VR_TOUCH_AXIS_UP) && IN_GetButtonAction("RTHUMBFORWARD", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UP;
// stop up-right
if ((controller->axisButtons & VR_TOUCH_AXIS_UPRIGHT) && IN_GetButtonAction("RTHUMBFORWARDRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_UPRIGHT;
// stop down-left
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWNLEFT) && IN_GetButtonAction("RTHUMBBACKLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWNLEFT;
// stop down
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWN) && IN_GetButtonAction("RTHUMBBACK", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWN;
// stop down-right
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWNRIGHT) && IN_GetButtonAction("RTHUMBBACKRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWNRIGHT;
// left
if (joystickX < -pressedThreshold) {
// left action
if (IN_GetButtonAction("RTHUMBLEFT", action)) {
vr.smooth_turning = false;
if (!(controller->axisButtons & VR_TOUCH_AXIS_LEFT)) {
IN_SendButtonAction(action, qtrue, qtrue);
if (!(controller->axisButtons & VR_TOUCH_AXIS_LEFT)) {
if (IN_GetButtonAction("RTHUMBLEFT", action)) {
if (!IN_SendButtonAction(action, qtrue, qtrue, absoluteAxisValue)) {
controller->axisButtons |= VR_TOUCH_AXIS_LEFT;
}
} else {
controller->axisButtons |= VR_TOUCH_AXIS_LEFT;
}
controller->axisButtons |= VR_TOUCH_AXIS_LEFT;
// yaw (snap turn)
} else if (vr_snapturn->integer > 0) {
vr.smooth_turning = false;
int snap = 45;
if (vr_snapturn->integer > 1) {
snap = vr_snapturn->integer;
}
if (!(controller->axisButtons & VR_TOUCH_AXIS_LEFT)) {
CL_SnapTurn(-snap);
}
// yaw (smooth turn)
} else {
vr.smooth_turning = true;
const float x = joystickX * cl_sensitivity->value * m_yaw->value;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, x, 0, 0, NULL);
}
controller->axisButtons |= VR_TOUCH_AXIS_LEFT;
} else if (joystickX > -releasedThreshold) {
if (joystickX < releasedThreshold) {
vr.smooth_turning = false;
}
if ((controller->axisButtons & VR_TOUCH_AXIS_LEFT) && IN_GetButtonAction("RTHUMBLEFT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
}
// right
if (joystickX > pressedThreshold) {
// right action
if (IN_GetButtonAction("RTHUMBRIGHT", action)) {
vr.smooth_turning = false;
if (!(controller->axisButtons & VR_TOUCH_AXIS_RIGHT)) {
IN_SendButtonAction(action, qtrue, qtrue);
if (!(controller->axisButtons & VR_TOUCH_AXIS_RIGHT)) {
if (IN_GetButtonAction("RTHUMBRIGHT", action)) {
if (!IN_SendButtonAction(action, qtrue, qtrue, absoluteAxisValue)) {
controller->axisButtons |= VR_TOUCH_AXIS_RIGHT;
}
} else {
controller->axisButtons |= VR_TOUCH_AXIS_RIGHT;
}
controller->axisButtons |= VR_TOUCH_AXIS_RIGHT;
// yaw (snap turn)
} else if (vr_snapturn->integer > 0) {
vr.smooth_turning = false;
int snap = 45;
if (vr_snapturn->integer > 1) {
snap = vr_snapturn->integer;
}
if (!(controller->axisButtons & VR_TOUCH_AXIS_RIGHT)) {
CL_SnapTurn(snap);
}
// yaw (smooth turn)
} else {
vr.smooth_turning = true;
const float x = joystickX * cl_sensitivity->value * m_yaw->value;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, x, 0, 0, NULL);
}
controller->axisButtons |= VR_TOUCH_AXIS_RIGHT;
} else if (joystickX < releasedThreshold) {
if (joystickX > -releasedThreshold) {
vr.smooth_turning = false;
}
if ((controller->axisButtons & VR_TOUCH_AXIS_RIGHT) && IN_GetButtonAction("RTHUMBRIGHT", action)) {
IN_SendButtonAction(action, qfalse, qtrue);
IN_SendButtonAction(action, qfalse, qtrue, absoluteAxisValue);
}
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
}
@ -830,10 +840,15 @@ static void IN_VRTriggers( qboolean isRightController, float index ) {
if (!(controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
index > pressedThreshold)
{
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
if (IN_GetButtonAction("PRIMARYTRIGGER", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
}
}
else
{
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
}
}
else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
@ -842,7 +857,7 @@ static void IN_VRTriggers( qboolean isRightController, float index ) {
controller->axisButtons &= ~VR_TOUCH_AXIS_TRIGGER_INDEX;
if (IN_GetButtonAction("PRIMARYTRIGGER", action))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
}
@ -853,10 +868,15 @@ static void IN_VRTriggers( qboolean isRightController, float index ) {
if (!(controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
index > pressedThreshold)
{
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
if (IN_GetButtonAction("SECONDARYTRIGGER", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
}
}
else
{
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
}
}
else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
@ -865,14 +885,14 @@ static void IN_VRTriggers( qboolean isRightController, float index ) {
controller->axisButtons &= ~VR_TOUCH_AXIS_TRIGGER_INDEX;
if (IN_GetButtonAction("SECONDARYTRIGGER", action))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
}
}
}
static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
static void IN_VRButtons( qboolean isRightController, uint32_t buttons )
{
char action[256];
@ -880,8 +900,10 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
{
if ((buttons & ovrButton_Enter) && !(controller->buttons & ovrButton_Enter)) {
controller->buttons |= ovrButton_Enter;
Com_QueueEvent(in_vrEventTime, SE_KEY, K_ESCAPE, qtrue, 0, NULL);
} else if (!(buttons & ovrButton_Enter) && (controller->buttons & ovrButton_Enter)) {
controller->buttons &= ~ovrButton_Enter;
Com_QueueEvent(in_vrEventTime, SE_KEY, K_ESCAPE, qfalse, 0, NULL);
}
}
@ -892,15 +914,22 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
{
if (IN_GetButtonAction("SECONDARYGRIP", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->buttons |= ovrButton_GripTrigger;
}
}
else
{
controller->buttons |= ovrButton_GripTrigger;
}
}
else if (!(buttons & ovrButton_GripTrigger) &&
(controller->buttons & ovrButton_GripTrigger))
{
controller->buttons &= ~ovrButton_GripTrigger;
if (IN_GetButtonAction("SECONDARYGRIP", action))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
}
@ -910,15 +939,22 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
{
if (IN_GetButtonAction("PRIMARYGRIP", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->buttons |= ovrButton_GripTrigger;
}
}
else
{
controller->buttons |= ovrButton_GripTrigger;
}
}
else if (!(buttons & ovrButton_GripTrigger) &&
(controller->buttons & ovrButton_GripTrigger))
{
controller->buttons &= ~ovrButton_GripTrigger;
if (IN_GetButtonAction("PRIMARYGRIP", action))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
}
@ -929,14 +965,21 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
if ((buttons & ovrButton_LThumb) && !(controller->buttons & ovrButton_LThumb)) {
if (IN_GetButtonAction("SECONDARYTHUMBSTICK", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->buttons |= ovrButton_LThumb;
}
}
else
{
controller->buttons |= ovrButton_LThumb;
}
vr.realign = 3;
} else if (!(buttons & ovrButton_LThumb) && (controller->buttons & ovrButton_LThumb)) {
controller->buttons &= ~ovrButton_LThumb;
if (IN_GetButtonAction("SECONDARYTHUMBSTICK", action))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
}
@ -945,12 +988,19 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
if ((buttons & ovrButton_RThumb) && !(controller->buttons & ovrButton_RThumb)) {
if (IN_GetButtonAction("PRIMARYTHUMBSTICK", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->buttons |= ovrButton_RThumb;
}
}
else
{
controller->buttons |= ovrButton_RThumb;
}
} else if (!(buttons & ovrButton_RThumb) && (controller->buttons & ovrButton_RThumb)) {
controller->buttons &= ~ovrButton_RThumb;
if (IN_GetButtonAction("PRIMARYTHUMBSTICK", action))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
}
@ -960,21 +1010,29 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
{
if (cl.snap.ps.pm_flags & PMF_FOLLOW)
{
controller->buttons |= ovrButton_A;
Cbuf_AddText("cmd team spectator\n");
}
else
{
if (IN_GetButtonAction("A", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->buttons |= ovrButton_A;
}
}
else
{
controller->buttons |= ovrButton_A;
}
}
}
else if (!(buttons & ovrButton_A) && (controller->buttons & ovrButton_A))
{
controller->buttons &= ~ovrButton_A;
if (IN_GetButtonAction("A", action) && !(cl.snap.ps.pm_flags & PMF_FOLLOW))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
@ -982,12 +1040,19 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
if ((buttons & ovrButton_B) && !(controller->buttons & ovrButton_B)) {
if (IN_GetButtonAction("B", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->buttons |= ovrButton_B;
}
}
else
{
controller->buttons |= ovrButton_B;
}
} else if (!(buttons & ovrButton_B) && (controller->buttons & ovrButton_B)) {
controller->buttons &= ~ovrButton_B;
if (IN_GetButtonAction("B", action))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
@ -1003,15 +1068,22 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
{
if (IN_GetButtonAction("X", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->buttons |= ovrButton_X;
}
}
else
{
controller->buttons |= ovrButton_X;
}
}
}
else if (!(buttons & ovrButton_X) && (controller->buttons & ovrButton_X))
{
controller->buttons &= ~ovrButton_X;
if (IN_GetButtonAction("X", action) && !(cl.snap.ps.pm_flags & PMF_FOLLOW))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
@ -1019,12 +1091,19 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
if ((buttons & ovrButton_Y) && !(controller->buttons & ovrButton_Y)) {
if (IN_GetButtonAction("Y", action))
{
IN_SendButtonAction(action, qtrue, qfalse);
if (!IN_SendButtonAction(action, qtrue, qfalse, 0)) {
controller->buttons |= ovrButton_Y;
}
}
else
{
controller->buttons |= ovrButton_Y;
}
} else if (!(buttons & ovrButton_Y) && (controller->buttons & ovrButton_Y)) {
controller->buttons &= ~ovrButton_Y;
if (IN_GetButtonAction("Y", action))
{
IN_SendButtonAction(action, qfalse, qfalse);
IN_SendButtonAction(action, qfalse, qfalse, 0);
}
}
@ -1139,10 +1218,7 @@ void IN_VRInputFrame( void )
continue;
}
if (controller->buttons ^ state.Buttons) {
IN_VRButtonsChanged(isRight, state.Buttons);
}
IN_VRButtons(isRight, state.Buttons);
IN_VRController(isRight, remoteTracking);
IN_VRJoystick(isRight, state.Joystick.x, state.Joystick.y);
IN_VRTriggers(isRight, state.IndexTrigger);

View file

@ -84,7 +84,8 @@ int main(int argc, char* argv[]) {
VR_EnterVR(engine, java);
while (1) {
SDL_Event event;
//Polling events here breaks sdl_input keyboard!
/*SDL_Event event;
while (SDL_PollEvent(&event)) {
LOGI("Received SDL Event: %d", event.type);
switch (event.type)
@ -97,7 +98,7 @@ int main(int argc, char* argv[]) {
VR_LeaveVR(engine);
break;
}
}
}*/
VR_DrawFrame(engine);
}

View file

@ -264,6 +264,9 @@ public class SDLActivity extends Activity {
if (SDLActivity.mBrokenLibraries) {
return;
}
if (mScreenKeyboardShown) {
return;
}
SDLActivity.mHasFocus = hasFocus;
if (hasFocus) {

View file

@ -8,7 +8,7 @@ menuDef {
visible 0
fullscreen 0
outOfBoundsClick // this closes the window if it gets a click out of the rectangle
rect 225 30 290 375
rect 195 30 350 375
focusColor 1 .75 0 1
style 1
border 1
@ -16,7 +16,7 @@ menuDef {
itemDef {
name window
rect 10 15 280 360
rect 10 15 340 360
style 1
backcolor 0 .1 0 1
visible 1
@ -36,7 +36,7 @@ itemDef {
}
itemDef {
name window
rect 64 10 52 8
rect 34 10 102 8
style 3
background "ui/assets/ingametop.tga"
visible 1
@ -44,7 +44,7 @@ itemDef {
}
itemDef {
name window
rect 184 10 52 8
rect 218 10 82 8
style 3
background "ui/assets/ingametop.tga"
visible 1
@ -53,7 +53,7 @@ itemDef {
itemDef {
name window
rect 237 10 64 64
rect 297 10 64 64
style 3
background "ui/assets/ingamerightcorner.tga"
visible 1
@ -61,7 +61,7 @@ itemDef {
}
itemDef {
name window
rect 114 0 73 16
rect 144 0 73 16
style 3
background "ui/assets/ingameconnection.tga"
visible 1
@ -77,7 +77,7 @@ itemDef {
}
itemDef {
name window
rect 237 314 64 64
rect 297 314 64 64
style 3
background "ui/assets/ingamerightcornerb.tga"
visible 1
@ -114,7 +114,7 @@ itemDef {
itemDef {
name window
rect 285 64 16 84
rect 345 64 16 84
style 3
background "ui/assets/ingameright.tga"
visible 1
@ -124,7 +124,7 @@ itemDef {
itemDef {
name window
rect 285 148 16 84
rect 345 148 16 84
style 3
background "ui/assets/ingameright.tga"
visible 1
@ -132,7 +132,7 @@ itemDef {
}
itemDef {
name window
rect 285 232 16 84
rect 345 232 16 84
style 3
background "ui/assets/ingameright.tga"
visible 1
@ -142,7 +142,7 @@ itemDef {
itemDef {
name window
rect 64 370 104 8
rect 34 370 134 8
style 3
background "ui/assets/ingamebottom.tga"
visible 1
@ -150,7 +150,7 @@ itemDef {
}
itemDef {
name window
rect 168 370 104 8
rect 198 370 134 8
style 3
background "ui/assets/ingamebottom.tga"
visible 1
@ -164,9 +164,9 @@ itemDef {
group grpOptions
text "Crosshair:"
ownerdraw UI_CROSSHAIR
rect 173 20 20 17
rect 193 20 20 17
textalign ITEM_ALIGN_RIGHT
textalignx 0
textalignx 0
textaligny 17
textscale .25
forecolor 1 1 1 1
@ -179,7 +179,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Laser Sight:"
cvar "vr_lasersight"
rect 30 37 200 20
rect 50 37 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -193,7 +193,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Simple Items (World):"
cvar "cg_simpleItems"
rect 30 54 200 20
rect 50 54 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -208,7 +208,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Simple Items (Holster):"
cvar "cg_weaponSelectorSimple2DIcons"
rect 30 71 200 20
rect 50 71 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -223,7 +223,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Show Item In Hand:"
cvar "vr_showItemInHand"
rect 30 88 200 20
rect 50 88 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -238,7 +238,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Marks On Walls:"
cvar "cg_marks"
rect 30 105 200 20
rect 50 105 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -253,7 +253,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Show Floating Scores:"
cvar "cg_scorePlums"
rect 30 122 200 20
rect 50 122 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -269,7 +269,7 @@ itemDef {
type ITEM_TYPE_MULTI
cvar "cg_brassTime"
cvarFloatList { "High" 2500 "Med" 1250 "Off" 0 }
rect 30 139 200 20
rect 50 139 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -284,7 +284,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Identify Target:"
cvar "cg_drawCrosshairNames"
rect 30 156 200 20
rect 50 156 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -299,7 +299,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Low Quality Sky:"
cvar "r_fastsky"
rect 30 173 200 20
rect 50 173 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -314,7 +314,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Force Player Models:"
cvar "cg_forceModel"
rect 30 190 200 20
rect 50 190 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -328,7 +328,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Draw Team Overlay:"
cvar "cg_drawTeamOverlay"
rect 30 207 200 20
rect 50 207 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -342,7 +342,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Show Time:"
cvar "cg_drawTimer"
rect 30 224 200 20
rect 50 224 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -356,7 +356,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Taunts Off:"
cvar "cg_noTaunt"
rect 30 241 200 20
rect 50 241 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -370,7 +370,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "In Game Video:"
cvar "r_inGameVideo"
rect 30 258 200 20
rect 50 258 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -385,22 +385,37 @@ itemDef {
text "Statusbar:"
cvar "cg_hudfiles"
cvarStrList { Normal "ui/hud.txt" Small "ui/hud2.txt" }
rect 30 275 200 20
rect 50 275 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
textscale .25
textscale .25
forecolor 1 1 1 1
visible 1
visible 1
}
itemDef {
name options
group grpOptions
type ITEM_TYPE_YESNO
text "Statusbar On Weapon Selector:"
cvar "vr_weaponSelectorWithHud"
rect 50 292 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
textscale .25
forecolor 1 1 1 1
visible 1
}
itemDef {
name options
group grpOptions
type ITEM_TYPE_YESNO
text "Blood:"
cvar "com_blood"
rect 30 292 200 20
rect 50 309 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -415,7 +430,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Gibs:"
cvar "cg_gibs"
rect 30 309 200 20
rect 50 326 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17
@ -429,9 +444,9 @@ itemDef {
name options
group grpOptions
type ITEM_TYPE_YESNO
text "Extra Gibs (Perf. Hit):"
text "Extra Gibs (Performance Hit):"
cvar "cg_megagibs"
rect 30 326 200 20
rect 50 343 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143
textaligny 17

View file

@ -275,13 +275,28 @@ itemDef {
visible 1
}
itemDef {
name options
group grpOptions
type ITEM_TYPE_YESNO
text "Statusbar On Weapon Selector:"
cvar "vr_weaponSelectorWithHud"
rect 99 335 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20
textscale .3
forecolor 1 1 1 1
visible 1
}
itemDef {
name options
group grpOptions
type ITEM_TYPE_YESNO
text "Blood:"
cvar "com_blood"
rect 99 345 256 20
rect 99 365 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20
@ -296,7 +311,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Gibs:"
cvar "cg_gibs"
rect 99 365 256 20
rect 99 385 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20
@ -311,7 +326,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Extra Gibs (Performance Hit):"
cvar "cg_megagibs"
rect 99 385 256 20
rect 99 405 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20

View file

@ -1,16 +1,31 @@
#!/bin/sh
cd ..
#!/bin/bash
TARGET=debug
WORKDIR=$(readlink -f $(dirname $0))
NAME=$(cat $WORKDIR/app/src/main/res/values/strings.xml | grep "app_name" | cut -d">" -f2 | cut -d"<" -f1 )
VERSION=$(cat $WORKDIR/app/src/main/AndroidManifest.xml | grep "versionName" | cut -d\" -f2 | cut -d\" -f1 )
PACKAGE_NAME=$(cat $WORKDIR/app/src/main/AndroidManifest.xml | grep "package" | cut -d\" -f2 | cut -d\" -f1 )
if [ "$1" == "clean" ] || [ "$2" == "clean" ] || [ "$3" == "clean" ]; then
rm -rf $WORKDIR/../build
rm -rf $WORKDIR/build
rm -rf $WORKDIR/app/build
rm -rf $WORKDIR/app/src/main/jniLibs
fi
echo "#define Q3QVERSION \"$VERSION"\" > $WORKDIR/app/src/main/cpp/code/vr/vr_version.h
cd $WORKDIR/..
make -j $(getconf _NPROCESSORS_ONLN) $TARGET
if [ $? -ne 0 ]; then
echo "Failed to build ioq3"
exit 1
fi
cd android
cd $WORKDIR
./make.sh
@ -19,19 +34,21 @@ if [ $? -ne 0 ]; then
exit 1
fi
PACKAGE_NAME=com.drbeef.ioq3quest
ANDROID_STORAGE_LOCATION=/sdcard/Android/data/$PACKAGE_NAME/files/
APK_LOCATION=./app/build/outputs/apk/debug/app-debug.apk
APK_LOCATION=$WORKDIR/app/build/outputs/apk/debug/app-debug.apk
adb install -r $APK_LOCATION
if [ $? -ne 0 ]; then
adb uninstall $PACKAGE_NAME
adb install $APK_LOCATION
if [ $? -ne 0 ]; then
echo "Failed to install apk."
exit 1
fi
if [ "$1" == "install" ] || [ "$2" == "install" ] || [ "$3" == "install" ]; then
adb install -r $APK_LOCATION
if [ $? -ne 0 ]; then
adb uninstall $PACKAGE_NAME
adb install $APK_LOCATION
if [ $? -ne 0 ]; then
echo "Failed to install apk."
exit 1
fi
fi
fi
#adb shell mkdir -p $ANDROID_STORAGE_LOCATION
#adb push --sync ~/.local/share/Steam/steamapps/common/Quake\ 3\ Arena/baseq3 $ANDROID_STORAGE_LOCATION
#if [ $? -ne 0 ]; then
@ -49,10 +66,12 @@ fi
# exit 1
#fi
adb logcat -c
adb shell am start -n $PACKAGE_NAME/.MainActivity
if [ $? -ne 0 ]; then
echo "Failed to start application."
exit 1
if [ "$1" == "start" ] || [ "$2" == "start" ] || [ "$3" == "start" ]; then
adb logcat -c
adb shell am start -n $PACKAGE_NAME/.MainActivity
if [ $? -ne 0 ]; then
echo "Failed to start application."
exit 1
fi
adb logcat *:S Quake3:V SDL:V DEBUG:V
fi
adb logcat *:S Quake3:V SDL:V DEBUG:V