mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2024-11-23 20:32:44 +00:00
Almost too many fixes to mention!
start of weapons working (6DoF) looks like glitchiness is fixed stereo working correctly most buttons working nicely positional tracking (sort of)
This commit is contained in:
parent
4201c1deca
commit
9a0823392c
23 changed files with 483 additions and 265 deletions
|
@ -33,6 +33,7 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved.
|
|||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_main.h>
|
||||
#include <SDL2/SDL_mutex.h>
|
||||
|
||||
#include "VrApi_Helpers.h"
|
||||
#include "VrApi_SystemUtils.h"
|
||||
|
@ -48,8 +49,7 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved.
|
|||
bool Doom3Quest_initialised;
|
||||
float playerYaw;
|
||||
float vrFOV;
|
||||
vec3_t worldPosition;
|
||||
float vr_weapon_pitchadjust;
|
||||
float vr_weapon_pitchadjust = -30.0f;
|
||||
bool vr_moveuseoffhand;
|
||||
float vr_snapturn_angle;
|
||||
bool vr_switchsticks;
|
||||
|
@ -335,7 +335,6 @@ static void ovrEgl_CreateContext( ovrEgl * egl, const ovrEgl * shareEgl )
|
|||
}
|
||||
|
||||
egl->Display = eglGetDisplay( EGL_DEFAULT_DISPLAY );
|
||||
ALOGV( " eglInitialize( Display, &MajorVersion, &MinorVersion )" );
|
||||
eglInitialize( egl->Display, &egl->MajorVersion, &egl->MinorVersion );
|
||||
// Do NOT use eglChooseConfig, because the Android EGL code pushes in multisample
|
||||
// flags in eglChooseConfig if the user has selected the "force 4x MSAA" option in
|
||||
|
@ -904,6 +903,8 @@ ovrApp
|
|||
================================================================================
|
||||
*/
|
||||
|
||||
#define MAX_TRACKING_SAMPLES 4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ovrJava Java;
|
||||
|
@ -912,9 +913,11 @@ typedef struct
|
|||
bool Resumed;
|
||||
ovrMobile * Ovr;
|
||||
ovrScene Scene;
|
||||
SDL_mutex * RenderThreadFrameIndex_Mutex;
|
||||
long long RenderThreadFrameIndex;
|
||||
double RenderThreadDisplayTime;
|
||||
double NextFrameDisplayTime;
|
||||
long long MainThreadFrameIndex;
|
||||
double DisplayTime[MAX_TRACKING_SAMPLES];
|
||||
ovrTracking2 Tracking[MAX_TRACKING_SAMPLES];
|
||||
int SwapInterval;
|
||||
int CpuLevel;
|
||||
int GpuLevel;
|
||||
|
@ -931,8 +934,11 @@ static void ovrApp_Clear( ovrApp * app )
|
|||
app->Java.Env = NULL;
|
||||
app->Java.ActivityObject = NULL;
|
||||
app->Ovr = NULL;
|
||||
app->RenderThreadFrameIndex_Mutex = SDL_CreateMutex();
|
||||
app->RenderThreadFrameIndex = 1;
|
||||
app->RenderThreadDisplayTime = 0;
|
||||
app->MainThreadFrameIndex = 1;
|
||||
memset(app->DisplayTime, 0, MAX_TRACKING_SAMPLES * sizeof(double));
|
||||
memset(app->Tracking, 0, MAX_TRACKING_SAMPLES * sizeof(ovrTracking2));
|
||||
app->SwapInterval = 1;
|
||||
app->CpuLevel = 4;
|
||||
app->GpuLevel = 4;
|
||||
|
@ -1258,7 +1264,7 @@ void VR_Init()
|
|||
srand(time(NULL));
|
||||
|
||||
//Initialise our cvar holders
|
||||
vr_weapon_pitchadjust = -30.0;
|
||||
vr_weapon_pitchadjust = -30.0f;
|
||||
|
||||
shutdown = false;
|
||||
}
|
||||
|
@ -1322,8 +1328,6 @@ bool Doom3Quest_processMessageQueue() {
|
|||
{
|
||||
if (!Doom3Quest_initialised)
|
||||
{
|
||||
ALOGV( " Initialising qzdoom Engine" );
|
||||
|
||||
//Set command line arguments here
|
||||
if (argc != 0)
|
||||
{
|
||||
|
@ -1373,21 +1377,13 @@ bool Doom3Quest_processMessageQueue() {
|
|||
|
||||
|
||||
void shutdownVR() {
|
||||
SDL_DestroyMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
ovrRenderer_Destroy( &gAppState.Renderer );
|
||||
ovrEgl_DestroyContext( &gAppState.Egl );
|
||||
(*java.Vm)->DetachCurrentThread( java.Vm );
|
||||
vrapi_Shutdown();
|
||||
}
|
||||
|
||||
void incrementRenderThreadFrameIndex()
|
||||
{
|
||||
gAppState.RenderThreadFrameIndex++;
|
||||
gAppState.RenderThreadDisplayTime = vrapi_GetPredictedDisplayTime(gAppState.Ovr,
|
||||
gAppState.RenderThreadFrameIndex);
|
||||
|
||||
ALOGV("gAppState.RenderThreadFrameIndex = %i, gAppState.RenderThreadDisplayTime = %g", gAppState.RenderThreadFrameIndex, gAppState.RenderThreadDisplayTime);
|
||||
}
|
||||
|
||||
void showLoadingIcon();
|
||||
void jni_shutdown();
|
||||
|
||||
|
@ -1479,6 +1475,7 @@ void * AppThreadFunction(void * parm ) {
|
|||
//Run loading loop until we are ready to start QzDoom
|
||||
while (!destroyed && !Doom3Quest_initialised) {
|
||||
Doom3Quest_processMessageQueue();
|
||||
Doom3Quest_getHMDOrientation();
|
||||
showLoadingIcon();
|
||||
}
|
||||
|
||||
|
@ -1552,47 +1549,57 @@ void showLoadingIcon()
|
|||
};
|
||||
|
||||
ovrSubmitFrameDescription2 frameDesc = {};
|
||||
frameDesc.Flags = frameFlags;
|
||||
frameDesc.SwapInterval = 1;
|
||||
frameDesc.FrameIndex = gAppState.RenderThreadFrameIndex;
|
||||
frameDesc.DisplayTime = gAppState.RenderThreadDisplayTime;
|
||||
frameDesc.LayerCount = 2;
|
||||
frameDesc.Layers = layers;
|
||||
{
|
||||
SDL_LockMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
|
||||
frameDesc.Flags = frameFlags;
|
||||
frameDesc.SwapInterval = 1;
|
||||
frameDesc.FrameIndex = gAppState.RenderThreadFrameIndex;
|
||||
frameDesc.DisplayTime = gAppState.DisplayTime[gAppState.RenderThreadFrameIndex %
|
||||
MAX_TRACKING_SAMPLES];
|
||||
frameDesc.LayerCount = 2;
|
||||
frameDesc.Layers = layers;
|
||||
|
||||
gAppState.RenderThreadFrameIndex++;
|
||||
|
||||
SDL_UnlockMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
}
|
||||
|
||||
vrapi_SubmitFrame2( gAppState.Ovr, &frameDesc );
|
||||
|
||||
incrementRenderThreadFrameIndex();
|
||||
}
|
||||
|
||||
void Doom3Quest_getHMDOrientation() {
|
||||
|
||||
// Get the HMD pose, predicted for the middle of the time period during which
|
||||
// the new eye images will be displayed. The number of frames predicted ahead
|
||||
// depends on the pipeline depth of the engine and the synthesis rate.
|
||||
// The better the prediction, the less black will be pulled in at the edges.
|
||||
gAppState.NextFrameDisplayTime = vrapi_GetPredictedDisplayTime(gAppState.Ovr,
|
||||
gAppState.RenderThreadFrameIndex+1);
|
||||
ovrTracking2 tracking = vrapi_GetPredictedTracking2(gAppState.Ovr, gAppState.NextFrameDisplayTime);
|
||||
ALOGV("nextFrameDisplayTime = %g", gAppState.NextFrameDisplayTime);
|
||||
//Update the main thread frame index in a thread safe way
|
||||
{
|
||||
SDL_LockMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
|
||||
gAppState.MainThreadFrameIndex = gAppState.RenderThreadFrameIndex + 1;
|
||||
|
||||
SDL_UnlockMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
}
|
||||
|
||||
gAppState.DisplayTime[gAppState.MainThreadFrameIndex % MAX_TRACKING_SAMPLES] = vrapi_GetPredictedDisplayTime(gAppState.Ovr, gAppState.MainThreadFrameIndex);
|
||||
|
||||
ovrTracking2 *tracking = &gAppState.Tracking[gAppState.MainThreadFrameIndex % MAX_TRACKING_SAMPLES];
|
||||
*tracking = vrapi_GetPredictedTracking2(gAppState.Ovr, gAppState.DisplayTime[gAppState.MainThreadFrameIndex % MAX_TRACKING_SAMPLES]);
|
||||
|
||||
// We extract Yaw, Pitch, Roll instead of directly using the orientation
|
||||
// to allow "additional" yaw manipulation with mouse/controller.
|
||||
const ovrQuatf quatHmd = tracking.HeadPose.Pose.Orientation;
|
||||
const ovrVector3f positionHmd = tracking.HeadPose.Pose.Position;
|
||||
const ovrQuatf quatHmd = tracking->HeadPose.Pose.Orientation;
|
||||
const ovrVector3f positionHmd = tracking->HeadPose.Pose.Position;
|
||||
vec3_t rotation = {0};
|
||||
QuatToYawPitchRoll(quatHmd, rotation, vr.hmdorientation);
|
||||
setHMDPosition(positionHmd.x, positionHmd.y, positionHmd.z, vr.hmdorientation[YAW]);
|
||||
|
||||
//TODO: fix - set to use HMD position for world position
|
||||
updateHMDOrientation();
|
||||
|
||||
ALOGV(" HMD-Position: %f, %f, %f", positionHmd.x, positionHmd.y, positionHmd.z);
|
||||
}
|
||||
|
||||
void Doom3Quest_getTrackedRemotesOrientation(int vr_control_scheme) {
|
||||
|
||||
//Get info for tracked remotes
|
||||
acquireTrackedRemotesData(gAppState.Ovr, gAppState.NextFrameDisplayTime);
|
||||
acquireTrackedRemotesData(gAppState.Ovr, gAppState.DisplayTime[gAppState.MainThreadFrameIndex % MAX_TRACKING_SAMPLES]);
|
||||
|
||||
//Call additional control schemes here
|
||||
switch ((int)vr_control_scheme)
|
||||
|
@ -1614,13 +1621,17 @@ void Doom3Quest_submitFrame()
|
|||
{
|
||||
ovrSubmitFrameDescription2 frameDesc = {0};
|
||||
|
||||
//Get the tracking info for the render thread frame id
|
||||
ovrTracking2 tracking = vrapi_GetPredictedTracking2(gAppState.Ovr, gAppState.RenderThreadDisplayTime);
|
||||
long long renderThreadFrameIndex;
|
||||
{
|
||||
SDL_LockMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
renderThreadFrameIndex = gAppState.RenderThreadFrameIndex;
|
||||
SDL_UnlockMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
}
|
||||
|
||||
if (!Doom3Quest_useScreenLayer()) {
|
||||
|
||||
ovrLayerProjection2 layer = vrapi_DefaultLayerProjection2();
|
||||
layer.HeadPose = tracking.HeadPose;
|
||||
layer.HeadPose = gAppState.Tracking[renderThreadFrameIndex % MAX_TRACKING_SAMPLES].HeadPose;
|
||||
for ( int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; eye++ )
|
||||
{
|
||||
ovrFramebuffer * frameBuffer = &gAppState.Renderer.FrameBuffer[gAppState.Renderer.NumBuffers == 1 ? 0 : eye];
|
||||
|
@ -1648,8 +1659,8 @@ void Doom3Quest_submitFrame()
|
|||
|
||||
frameDesc.Flags = 0;
|
||||
frameDesc.SwapInterval = gAppState.SwapInterval;
|
||||
frameDesc.FrameIndex = gAppState.RenderThreadFrameIndex;
|
||||
frameDesc.DisplayTime = gAppState.RenderThreadDisplayTime;
|
||||
frameDesc.FrameIndex = renderThreadFrameIndex;
|
||||
frameDesc.DisplayTime = gAppState.DisplayTime[renderThreadFrameIndex % MAX_TRACKING_SAMPLES];
|
||||
frameDesc.LayerCount = 1;
|
||||
frameDesc.Layers = layers;
|
||||
|
||||
|
@ -1666,7 +1677,7 @@ void Doom3Quest_submitFrame()
|
|||
// Add a simple cylindrical layer
|
||||
gAppState.Layers[gAppState.LayerCount++].Cylinder =
|
||||
BuildCylinderLayer(&gAppState.Scene.CylinderRenderer,
|
||||
gAppState.Scene.CylinderWidth, gAppState.Scene.CylinderHeight, &tracking, radians(playerYaw) );
|
||||
gAppState.Scene.CylinderWidth, gAppState.Scene.CylinderHeight, &gAppState.Tracking[renderThreadFrameIndex % MAX_TRACKING_SAMPLES], radians(playerYaw) );
|
||||
|
||||
// Compose the layers for this frame.
|
||||
const ovrLayerHeader2 * layerHeaders[ovrMaxLayerCount] = { 0 };
|
||||
|
@ -1678,8 +1689,8 @@ void Doom3Quest_submitFrame()
|
|||
// Set up the description for this frame.
|
||||
frameDesc.Flags = 0;
|
||||
frameDesc.SwapInterval = gAppState.SwapInterval;
|
||||
frameDesc.FrameIndex = gAppState.RenderThreadFrameIndex;
|
||||
frameDesc.DisplayTime = gAppState.RenderThreadDisplayTime;
|
||||
frameDesc.FrameIndex = renderThreadFrameIndex;
|
||||
frameDesc.DisplayTime = gAppState.DisplayTime[renderThreadFrameIndex % MAX_TRACKING_SAMPLES];
|
||||
frameDesc.LayerCount = gAppState.LayerCount;
|
||||
frameDesc.Layers = layerHeaders;
|
||||
|
||||
|
@ -1687,7 +1698,11 @@ void Doom3Quest_submitFrame()
|
|||
vrapi_SubmitFrame2(gAppState.Ovr, &frameDesc);
|
||||
}
|
||||
|
||||
incrementRenderThreadFrameIndex();
|
||||
{
|
||||
SDL_LockMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
gAppState.RenderThreadFrameIndex++;
|
||||
SDL_UnlockMutex(gAppState.RenderThreadFrameIndex_Mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,13 +31,11 @@ typedef struct {
|
|||
vec3_t hmdorientation_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t hmdorientation_delta;
|
||||
|
||||
vec3_t weaponangles_knife;
|
||||
vec3_t weaponangles_flashlight;
|
||||
vec3_t weaponangles;
|
||||
vec3_t weaponangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta;
|
||||
|
||||
float weapon_recoil; // recoil effect to improve the default
|
||||
|
||||
vec3_t current_weaponoffset;
|
||||
vec3_t calculated_weaponoffset;
|
||||
float current_weaponoffset_timestamp;
|
||||
|
@ -52,8 +50,6 @@ typedef struct {
|
|||
bool scopedetached; // Scope has been detached from weapon
|
||||
bool detachablescope; // Scope can be detached from weapon
|
||||
|
||||
bool hasbinoculars;
|
||||
|
||||
bool velocitytriggered; // Weapon attack triggered by velocity (knife)
|
||||
|
||||
vec3_t offhandangles;
|
||||
|
|
|
@ -31,8 +31,6 @@ float playerYaw;
|
|||
|
||||
bool showingScreenLayer;
|
||||
|
||||
ovrTracking2 tracking;
|
||||
|
||||
float radians(float deg);
|
||||
|
||||
float degrees(float rad);
|
||||
|
@ -51,10 +49,22 @@ void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out);
|
|||
|
||||
void QuatToYawPitchRoll(ovrQuatf q, vec3_t rotation, vec3_t out);
|
||||
|
||||
void handleTrackedControllerButton(ovrInputStateTrackedRemote *trackedRemoteState,
|
||||
void handleTrackedControllerButton_AsButton(ovrInputStateTrackedRemote *trackedRemoteState,
|
||||
ovrInputStateTrackedRemote *prevTrackedRemoteState,
|
||||
bool mouse, uint32_t button, int key);
|
||||
|
||||
void handleTrackedControllerButton_AsKey(ovrInputStateTrackedRemote *trackedRemoteState,
|
||||
ovrInputStateTrackedRemote *prevTrackedRemoteState,
|
||||
uint32_t button, int key);
|
||||
|
||||
void handleTrackedControllerButton_AsToggleButton(ovrInputStateTrackedRemote *trackedRemoteState,
|
||||
ovrInputStateTrackedRemote *prevTrackedRemoteState,
|
||||
uint32_t button, int key);
|
||||
|
||||
void handleTrackedControllerButton_AsImpulse(ovrInputStateTrackedRemote * trackedRemoteState,
|
||||
ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key);
|
||||
|
||||
|
||||
void interactWithTouchScreen(bool reset, ovrInputStateTrackedRemote *newState,
|
||||
ovrInputStateTrackedRemote *oldState);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ ovrLayerCylinder2 BuildCylinderLayer( ovrRenderer * cylinderRenderer,
|
|||
|
||||
const float density = 4500.0f;
|
||||
const float rotateYaw = 0.0f;
|
||||
const float radius = 4.0f;
|
||||
const float radius = 6.0f;
|
||||
const ovrVector3f translation = { 0.0f, 0.0f, -2.5f };
|
||||
|
||||
ovrMatrix4f cylinderTransform =
|
||||
|
|
|
@ -6,7 +6,6 @@ extern "C" {
|
|||
extern float vr_turn_mode;
|
||||
extern float vr_turn_angle;
|
||||
extern float vr_reloadtimeoutms;
|
||||
extern float vr_positional_factor;
|
||||
extern float vr_walkdirection;
|
||||
extern float vr_movement_multiplier;
|
||||
extern float vr_weapon_pitchadjust;
|
||||
|
|
|
@ -19,22 +19,40 @@ void Sys_AddMouseMoveEvent(int dx, int dy);
|
|||
void Sys_AddMouseButtonEvent(int button, bool pressed);
|
||||
void Sys_AddKeyEvent(int key, bool pressed);
|
||||
|
||||
//keys.h
|
||||
//void Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr );
|
||||
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, bool mouse, uint32_t button, int key)
|
||||
void Android_ButtonChange(int key, int state);
|
||||
int Android_GetButton(int key);
|
||||
|
||||
void handleTrackedControllerButton_AsButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, bool mouse, uint32_t button, int key)
|
||||
{
|
||||
if ((trackedRemoteState->Buttons & button) != (prevTrackedRemoteState->Buttons & button))
|
||||
{
|
||||
if (mouse) {
|
||||
if (mouse)
|
||||
{
|
||||
Sys_AddMouseButtonEvent(key, (trackedRemoteState->Buttons & button) != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_AddKeyEvent(key, (trackedRemoteState->Buttons & button) != 0);
|
||||
Android_ButtonChange(key, ((trackedRemoteState->Buttons & button) != 0) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handleTrackedControllerButton_AsKey(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key)
|
||||
{
|
||||
if ((trackedRemoteState->Buttons & button) != (prevTrackedRemoteState->Buttons & button))
|
||||
{
|
||||
Sys_AddKeyEvent(key, (trackedRemoteState->Buttons & button) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
void handleTrackedControllerButton_AsToggleButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key)
|
||||
{
|
||||
if ((trackedRemoteState->Buttons & button) != (prevTrackedRemoteState->Buttons & button))
|
||||
{
|
||||
Android_ButtonChange(key, Android_GetButton(key) ? 0 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sendButtonAction(const char* action, long buttonDown) {}
|
||||
void sendButtonActionSimple(const char* action) {}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ Authors : Simon Brown
|
|||
float vr_turn_mode = 0.0f;
|
||||
float vr_turn_angle = 45.0f;
|
||||
float vr_reloadtimeoutms;
|
||||
float vr_positional_factor;
|
||||
float vr_walkdirection;
|
||||
float vr_movement_multiplier;
|
||||
float vr_weapon_pitchadjust;
|
||||
|
@ -58,7 +57,8 @@ int Sys_Milliseconds( void ) {
|
|||
return curtime;
|
||||
}
|
||||
|
||||
|
||||
void Android_SetImpuse(int impulse);
|
||||
void Android_SetCommand(const char * cmd);
|
||||
|
||||
void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
|
||||
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTracking* pOffTracking,
|
||||
|
@ -128,29 +128,24 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] = 30;
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, pVRClientInfo->weaponangles_knife);
|
||||
rotation[PITCH] = vr_weapon_pitchadjust +
|
||||
(pVRClientInfo->pistol ? pVRClientInfo->weapon_recoil : 0.0f); // Our hacked recoil effect
|
||||
pVRClientInfo->weapon_recoil *= 0.8f; // quick reduction on synthetic recoil
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, pVRClientInfo->weaponangles_flashlight);
|
||||
|
||||
rotation[PITCH] = vr_weapon_pitchadjust;
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, pVRClientInfo->weaponangles);
|
||||
|
||||
VectorSubtract(pVRClientInfo->weaponangles_last, pVRClientInfo->weaponangles, pVRClientInfo->weaponangles_delta);
|
||||
VectorCopy(pVRClientInfo->weaponangles, pVRClientInfo->weaponangles_last);
|
||||
|
||||
ALOGV(" weaponangles_last: %f, %f, %f",
|
||||
pVRClientInfo->weaponangles_last[0], pVRClientInfo->weaponangles_last[1], pVRClientInfo->weaponangles_last[2]);
|
||||
|
||||
}
|
||||
|
||||
//Menu button
|
||||
handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, false, ovrButton_Enter, K_ESCAPE);
|
||||
handleTrackedControllerButton_AsKey(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, K_ESCAPE);
|
||||
|
||||
static bool resetCursor = true;
|
||||
if ( Doom3Quest_useScreenLayer() )
|
||||
{
|
||||
interactWithTouchScreen(resetCursor, pDominantTrackedRemoteNew, pDominantTrackedRemoteOld);
|
||||
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, true, ovrButton_Trigger, 1);
|
||||
handleTrackedControllerButton_AsButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, true, ovrButton_Trigger, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -171,13 +166,18 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
if (((pOffTrackedRemoteNew->Buttons & offButton1) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton1)) &&
|
||||
(pOffTrackedRemoteNew->Buttons & offButton1)) {
|
||||
sendButtonActionSimple("savegame quicksave");
|
||||
Android_SetCommand("savegame quick");
|
||||
}
|
||||
|
||||
if (((pOffTrackedRemoteNew->Buttons & offButton2) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton2)) &&
|
||||
(pOffTrackedRemoteNew->Buttons & offButton2)) {
|
||||
sendButtonActionSimple("loadgame quicksave");
|
||||
Android_SetCommand("loadgame quick");
|
||||
}
|
||||
} else {
|
||||
if (((pOffTrackedRemoteNew->Buttons & offButton1) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton1))) {
|
||||
handleTrackedControllerButton_AsButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, false, offButton1, UB_IMPULSE19);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,18 +225,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
scopeEngaged = pVRClientInfo->scopeengaged;
|
||||
}
|
||||
|
||||
|
||||
static bool binocularstate = false;
|
||||
bool binocularsactive = (pVRClientInfo->hasbinoculars && pVRClientInfo->backpackitemactive == 3 &&
|
||||
(distanceToHMD < BINOCULAR_ENGAGE_DISTANCE) &&
|
||||
(pDominantTracking->Status & (VRAPI_TRACKING_STATUS_POSITION_TRACKED | VRAPI_TRACKING_STATUS_POSITION_VALID)));
|
||||
if (binocularstate != binocularsactive)
|
||||
{
|
||||
//Engage scope if conditions are right
|
||||
binocularstate = binocularsactive;
|
||||
sendButtonAction("+zoom", binocularstate);
|
||||
}
|
||||
|
||||
//dominant hand stuff first
|
||||
{
|
||||
//Record recent weapon position for trajectory based stuff
|
||||
|
@ -282,10 +270,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
sendButtonAction("+attack", velocityTriggeredAttack);
|
||||
}
|
||||
|
||||
if (pVRClientInfo->weapon_stabilised || pVRClientInfo->dualwield)
|
||||
if (pVRClientInfo->weapon_stabilised)
|
||||
{
|
||||
if (pVRClientInfo->scopeengaged || (vr_virtual_stock == 1 && // Classic Virtual Stock
|
||||
!pVRClientInfo->dualwield))
|
||||
if (pVRClientInfo->scopeengaged)
|
||||
{
|
||||
//offset to the appropriate eye a little bit
|
||||
vec2_t xy;
|
||||
|
@ -308,12 +295,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
float zxDist = length(x, z);
|
||||
|
||||
if (zxDist != 0.0f && z != 0.0f) {
|
||||
if (pVRClientInfo->dualwield) {
|
||||
//SUPER FUDGE
|
||||
VectorSet(pVRClientInfo->weaponangles, pVRClientInfo->weaponangles[PITCH],
|
||||
-90.0f-degrees(atan2f(x, -z)), degrees(atanf(y / zxDist)));
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet(pVRClientInfo->weaponangles, -degrees(atanf(y / zxDist)),
|
||||
-degrees(atan2f(x, -z)), pVRClientInfo->weaponangles[ROLL] / 2.0f); //Dampen roll on stabilised weapon
|
||||
|
@ -322,14 +303,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
}
|
||||
|
||||
static bool finishReloadNextFrame = false;
|
||||
if (finishReloadNextFrame)
|
||||
{
|
||||
ALOGV("**WEAPON EVENT** -reload");
|
||||
sendButtonActionSimple("-reload");
|
||||
finishReloadNextFrame = false;
|
||||
}
|
||||
|
||||
if (pDominantTracking->Status & (VRAPI_TRACKING_STATUS_POSITION_TRACKED | VRAPI_TRACKING_STATUS_POSITION_VALID)) {
|
||||
canUseBackpack = false;
|
||||
}
|
||||
|
@ -363,10 +336,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
sendButtonActionSimple(buffer);
|
||||
pVRClientInfo->backpackitemactive = 0;
|
||||
}
|
||||
else if ((GetTimeInMilliSeconds() - dominantGripPushTime) <
|
||||
vr_reloadtimeoutms) {
|
||||
sendButtonActionSimple("+reload");
|
||||
finishReloadNextFrame = true;
|
||||
else if ((GetTimeInMilliSeconds() - dominantGripPushTime) < vr_reloadtimeoutms) {
|
||||
|
||||
Android_SetImpuse(UB_IMPULSE13);
|
||||
}
|
||||
dominantGripPushTime = 0;
|
||||
}
|
||||
|
@ -396,18 +368,19 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
else if (dominantButton1Pushed)
|
||||
{
|
||||
pVRClientInfo->lastweaponid = pVRClientInfo->weaponid;
|
||||
|
||||
//Initiate knife from backpack mode
|
||||
sendButtonActionSimple("weapon 1");
|
||||
int channel = (vr_control_scheme >= 10) ? 0 : 1;
|
||||
Doom3Quest_Vibrate(80, channel, 0.8); // vibrate to let user know they switched
|
||||
pVRClientInfo->backpackitemactive = 2;
|
||||
}
|
||||
else if (dominantButton2Pushed && pVRClientInfo->hasbinoculars)
|
||||
/*else if (dominantButton2Pushed && pVRClientInfo->hasbinoculars)
|
||||
{
|
||||
int channel = (vr_control_scheme >= 10) ? 0 : 1;
|
||||
Doom3Quest_Vibrate(80, channel, 0.8); // vibrate to let user know they switched
|
||||
pVRClientInfo->backpackitemactive = 3;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,87 +409,31 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
//This section corrects for the fact that the controller actually controls direction of movement, but we want to move relative to the direction the
|
||||
//player is facing for positional tracking
|
||||
vec2_t v;
|
||||
vr_positional_factor = 1000;
|
||||
float vr_positional_factor = 2500;
|
||||
rotateAboutOrigin(-pVRClientInfo->hmdposition_delta[0] * vr_positional_factor,
|
||||
pVRClientInfo->hmdposition_delta[2] * vr_positional_factor, - pVRClientInfo->hmdorientation[YAW], v);
|
||||
positional_movementSideways = v[0];
|
||||
positional_movementForward = v[1];
|
||||
|
||||
ALOGV(" positional_movementSideways: %f, positional_movementForward: %f",
|
||||
positional_movementSideways,
|
||||
positional_movementForward);
|
||||
|
||||
//Jump (B Button)
|
||||
if (pVRClientInfo->backpackitemactive != 2 && !canUseBackpack) {
|
||||
|
||||
if ((primaryButtonsNew & primaryButton2) != (primaryButtonsOld & primaryButton2))
|
||||
{
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, false, primaryButton2, K_SPACE);
|
||||
handleTrackedControllerButton_AsButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, false, primaryButton2, UB_UP);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//We need to record if we have started firing primary so that releasing trigger will stop firing, if user has pushed grip
|
||||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||
static bool firing = false;
|
||||
if (dominantGripPushed && pVRClientInfo->backpackitemactive == 0)
|
||||
{
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger))
|
||||
{
|
||||
if (!pVRClientInfo->scopedweapon) {
|
||||
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
|
||||
ALOGV("**WEAPON EVENT** weapalt");
|
||||
sendButtonActionSimple("weapalt");
|
||||
}
|
||||
else if (firing)
|
||||
{
|
||||
//no longer firing
|
||||
firing = false;
|
||||
ALOGV("**WEAPON EVENT** Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
||||
sendButtonAction("+attack", firing);
|
||||
}
|
||||
}
|
||||
else if (pVRClientInfo->detachablescope)
|
||||
{
|
||||
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
|
||||
//See if we are able to detach the scope
|
||||
ALOGV("**WEAPON EVENT** weapdetachscope");
|
||||
sendButtonActionSimple("weapdetachscope");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Just ignore grip and fire
|
||||
firing = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
|
||||
ALOGV("**WEAPON EVENT** Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
||||
sendButtonAction("+attack", firing);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Fire Primary
|
||||
if (pVRClientInfo->backpackitemactive != 3 && // Can't fire while holding binoculars
|
||||
!pVRClientInfo->velocitytriggered && // Don't fire velocity triggered weapons
|
||||
(pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||
//Fire Primary
|
||||
if (pVRClientInfo->backpackitemactive != 3 && // Can't fire while holding binoculars
|
||||
!pVRClientInfo->velocitytriggered && // Don't fire velocity triggered weapons
|
||||
(pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||
|
||||
ALOGV("**WEAPON EVENT** Not Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
||||
firing = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
|
||||
ALOGV("**WEAPON EVENT** Not Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
||||
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, false, ovrButton_Trigger, K_CTRL);
|
||||
}
|
||||
else if (binocularsactive) // trigger can zoom-in binoculars, remove from face to reset
|
||||
{
|
||||
static bool zoomin = true;
|
||||
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
|
||||
sendButtonActionSimple(zoomin ? "weapnext" : "weapprev");
|
||||
} else if (pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)
|
||||
{
|
||||
zoomin = !zoomin;
|
||||
}
|
||||
}
|
||||
handleTrackedControllerButton_AsButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, false, ovrButton_Trigger, UB_ATTACK);
|
||||
}
|
||||
|
||||
//Duck
|
||||
|
@ -525,7 +442,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
(primaryButtonsNew & primaryButton1) !=
|
||||
(primaryButtonsOld & primaryButton1)) {
|
||||
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, false, primaryButton1, 'c');
|
||||
handleTrackedControllerButton_AsToggleButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, primaryButton1, UB_DOWN);
|
||||
}
|
||||
|
||||
//Weapon Chooser
|
||||
|
@ -537,11 +454,13 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
if (!itemSwitched) {
|
||||
if (between(0.8f, pPrimaryJoystick->y, 1.0f))
|
||||
{
|
||||
sendButtonActionSimple("weapprev");
|
||||
//Previous Weapon
|
||||
Android_SetImpuse(UB_IMPULSE15);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendButtonActionSimple("weapnext");
|
||||
//Next Weapon
|
||||
Android_SetImpuse(UB_IMPULSE14);
|
||||
}
|
||||
itemSwitched = true;
|
||||
}
|
||||
|
@ -551,12 +470,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
|
||||
{
|
||||
//"Use" (open doors etc)
|
||||
//"Use"
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Joystick)) {
|
||||
|
||||
sendButtonAction("+activate",
|
||||
(pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) ? 1 : 0);
|
||||
//Use Vehicle
|
||||
Android_SetImpuse(UB_IMPULSE40);
|
||||
}
|
||||
|
||||
//Apply a filter and quadratic scaler so small movements are easier to make
|
||||
|
@ -572,20 +491,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
rotateAboutOrigin(x, y, controllerYawHeading, v);
|
||||
|
||||
//Move a lot slower if scope is engaged
|
||||
vr_movement_multiplier = 100;
|
||||
vr_movement_multiplier = 127;
|
||||
remote_movementSideways = v[0] * (pVRClientInfo->scopeengaged ? 0.3f : 1.0f) * vr_movement_multiplier;
|
||||
remote_movementForward = v[1] * (pVRClientInfo->scopeengaged ? 0.3f : 1.0f) * vr_movement_multiplier;
|
||||
ALOGV(" remote_movementSideways: %f, remote_movementForward: %f",
|
||||
remote_movementSideways,
|
||||
remote_movementForward);
|
||||
|
||||
|
||||
static bool stopUseItemNextFrame = false;
|
||||
if (stopUseItemNextFrame)
|
||||
{
|
||||
// Cbuf_AddText("-useitem\n");
|
||||
stopUseItemNextFrame = false;
|
||||
}
|
||||
|
||||
if (!canUseQuickSave) {
|
||||
if (((secondaryButtonsNew & secondaryButton1) !=
|
||||
|
@ -593,33 +501,18 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
(secondaryButtonsNew & secondaryButton1)) {
|
||||
|
||||
if (dominantGripPushed) {
|
||||
// Cbuf_AddText("+useitem\n");
|
||||
stopUseItemNextFrame = true;
|
||||
Android_SetCommand("give all");
|
||||
} else {
|
||||
pVRClientInfo->visible_hud = !pVRClientInfo->visible_hud;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//notebook or select "item"
|
||||
if (!canUseQuickSave) {
|
||||
if (((secondaryButtonsNew & secondaryButton2) !=
|
||||
(secondaryButtonsOld & secondaryButton2)) &&
|
||||
(secondaryButtonsNew & secondaryButton2)) {
|
||||
|
||||
if (dominantGripPushed) {
|
||||
sendButtonActionSimple("itemprev");
|
||||
} else {
|
||||
sendButtonActionSimple("notebook");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Kick!
|
||||
if ((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) !=
|
||||
(pOffTrackedRemoteOld->Buttons & ovrButton_Joystick)) {
|
||||
sendButtonAction("+kick", (pOffTrackedRemoteNew->Buttons & ovrButton_Joystick));
|
||||
|
||||
//UNUSED
|
||||
|
||||
}
|
||||
|
||||
//We need to record if we have started firing primary so that releasing trigger will stop definitely firing, if user has pushed grip
|
||||
|
@ -627,7 +520,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
if (!pVRClientInfo->teleportenabled)
|
||||
{
|
||||
//Run
|
||||
handleTrackedControllerButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, false, ovrButton_Trigger, K_SHIFT);
|
||||
handleTrackedControllerButton_AsButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, false, ovrButton_Trigger, UB_SPEED);
|
||||
|
||||
} else {
|
||||
if (pOffTrackedRemoteNew->Buttons & ovrButton_Trigger)
|
||||
{
|
||||
|
@ -641,17 +535,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//Resync Yaw on mounted gun transition
|
||||
static int usingMountedGun = false;
|
||||
if (pVRClientInfo->mountedgun != usingMountedGun)
|
||||
{
|
||||
usingMountedGun = pVRClientInfo->mountedgun;
|
||||
}
|
||||
|
||||
//No snap turn when using mounted gun
|
||||
static int increaseSnap = true;
|
||||
if (!pVRClientInfo->mountedgun && !pVRClientInfo->scopeengaged) {
|
||||
if (!pVRClientInfo->scopeengaged) {
|
||||
if (pPrimaryJoystick->x > 0.7f) {
|
||||
if (increaseSnap) {
|
||||
float turnAngle = vr_turn_mode ? (vr_turn_angle / 9.0f) : vr_turn_angle;
|
||||
|
|
|
@ -5,6 +5,105 @@
|
|||
#ifndef DOOMKEYS_H
|
||||
#define DOOMKEYS_H
|
||||
|
||||
|
||||
typedef enum {
|
||||
UB_NONE,
|
||||
|
||||
UB_UP,
|
||||
UB_DOWN,
|
||||
UB_LEFT,
|
||||
UB_RIGHT,
|
||||
UB_FORWARD,
|
||||
UB_BACK,
|
||||
UB_LOOKUP,
|
||||
UB_LOOKDOWN,
|
||||
UB_STRAFE,
|
||||
UB_MOVELEFT,
|
||||
UB_MOVERIGHT,
|
||||
|
||||
UB_BUTTON0,
|
||||
UB_BUTTON1,
|
||||
UB_BUTTON2,
|
||||
UB_BUTTON3,
|
||||
UB_BUTTON4,
|
||||
UB_BUTTON5,
|
||||
UB_BUTTON6,
|
||||
UB_BUTTON7,
|
||||
|
||||
UB_ATTACK,
|
||||
UB_SPEED,
|
||||
UB_ZOOM,
|
||||
UB_SHOWSCORES,
|
||||
UB_MLOOK,
|
||||
|
||||
UB_IMPULSE0,
|
||||
UB_IMPULSE1,
|
||||
UB_IMPULSE2,
|
||||
UB_IMPULSE3,
|
||||
UB_IMPULSE4,
|
||||
UB_IMPULSE5,
|
||||
UB_IMPULSE6,
|
||||
UB_IMPULSE7,
|
||||
UB_IMPULSE8,
|
||||
UB_IMPULSE9,
|
||||
UB_IMPULSE10,
|
||||
UB_IMPULSE11,
|
||||
UB_IMPULSE12,
|
||||
UB_IMPULSE13,
|
||||
UB_IMPULSE14,
|
||||
UB_IMPULSE15,
|
||||
UB_IMPULSE16,
|
||||
UB_IMPULSE17,
|
||||
UB_IMPULSE18,
|
||||
UB_IMPULSE19,
|
||||
UB_IMPULSE20,
|
||||
UB_IMPULSE21,
|
||||
UB_IMPULSE22,
|
||||
UB_IMPULSE23,
|
||||
UB_IMPULSE24,
|
||||
UB_IMPULSE25,
|
||||
UB_IMPULSE26,
|
||||
UB_IMPULSE27,
|
||||
UB_IMPULSE28,
|
||||
UB_IMPULSE29,
|
||||
UB_IMPULSE30,
|
||||
UB_IMPULSE31,
|
||||
UB_IMPULSE32,
|
||||
UB_IMPULSE33,
|
||||
UB_IMPULSE34,
|
||||
UB_IMPULSE35,
|
||||
UB_IMPULSE36,
|
||||
UB_IMPULSE37,
|
||||
UB_IMPULSE38,
|
||||
UB_IMPULSE39,
|
||||
UB_IMPULSE40,
|
||||
UB_IMPULSE41,
|
||||
UB_IMPULSE42,
|
||||
UB_IMPULSE43,
|
||||
UB_IMPULSE44,
|
||||
UB_IMPULSE45,
|
||||
UB_IMPULSE46,
|
||||
UB_IMPULSE47,
|
||||
UB_IMPULSE48,
|
||||
UB_IMPULSE49,
|
||||
UB_IMPULSE50,
|
||||
UB_IMPULSE51,
|
||||
UB_IMPULSE52,
|
||||
UB_IMPULSE53,
|
||||
UB_IMPULSE54,
|
||||
UB_IMPULSE55,
|
||||
UB_IMPULSE56,
|
||||
UB_IMPULSE57,
|
||||
UB_IMPULSE58,
|
||||
UB_IMPULSE59,
|
||||
UB_IMPULSE60,
|
||||
UB_IMPULSE61,
|
||||
UB_IMPULSE62,
|
||||
UB_IMPULSE63,
|
||||
|
||||
UB_MAX_BUTTONS
|
||||
} usercmdButton_t;
|
||||
|
||||
typedef enum {
|
||||
|
||||
// DG: please don't change any existing constants for keyboard keys below (or recreate the tables in win_input.cpp)!
|
||||
|
|
|
@ -203,11 +203,11 @@ float SCR_DrawFPS( float y ) {
|
|||
static int fps = 0;
|
||||
static int previous;
|
||||
int t, frameTime;
|
||||
static int stereoSide = 0;
|
||||
|
||||
int new_y = idMath::FtoiFast(y) + 300;
|
||||
|
||||
if (stereoSide == 0) {
|
||||
int eye = cvarSystem->GetCVarInteger("vr_eye");
|
||||
if (eye == 0) {
|
||||
// don't use serverTime, because that will be drifting to
|
||||
// correct for internet lag changes, timescales, timedemos, etc
|
||||
t = Sys_Milliseconds();
|
||||
|
@ -234,7 +234,6 @@ float SCR_DrawFPS( float y ) {
|
|||
renderSystem->DrawSmallStringExt((634 / 2) - w, new_y, s, colorWhite, true,
|
||||
localConsole.charSetShader);
|
||||
}
|
||||
stereoSide = 1;
|
||||
}
|
||||
else {
|
||||
//For right eye just use same value
|
||||
|
@ -242,7 +241,6 @@ float SCR_DrawFPS( float y ) {
|
|||
w = strlen(s) * SMALLCHAR_WIDTH;
|
||||
renderSystem->DrawSmallStringExt((634 / 2) - w, new_y, s, colorWhite, true,
|
||||
localConsole.charSetShader);
|
||||
stereoSide = 0;
|
||||
}
|
||||
|
||||
return y + BIGCHAR_HEIGHT + 4;
|
||||
|
|
|
@ -48,7 +48,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
idCVar idSessionLocal::com_showAngles( "com_showAngles", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
idCVar idSessionLocal::com_minTics( "com_minTics", "1", CVAR_SYSTEM, "" );
|
||||
idCVar idSessionLocal::com_showTics( "com_showTics", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
idCVar idSessionLocal::com_fixedTic( "com_fixedTic", "-1", CVAR_SYSTEM | CVAR_INTEGER | CVAR_ARCHIVE, "", -1, 10 );
|
||||
idCVar idSessionLocal::com_fixedTic( "com_fixedTic", "0", CVAR_SYSTEM | CVAR_INTEGER | CVAR_ARCHIVE, "", -1, 10 );
|
||||
idCVar idSessionLocal::com_showDemo( "com_showDemo", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
idCVar idSessionLocal::com_skipGameDraw( "com_skipGameDraw", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
idCVar idSessionLocal::com_aviDemoSamples( "com_aviDemoSamples", "16", CVAR_SYSTEM, "" );
|
||||
|
@ -2510,7 +2510,10 @@ void idSessionLocal::UpdateScreen( bool outOfSequence ) {
|
|||
}
|
||||
|
||||
for (int eye = 0; eye < 2; ++eye) {
|
||||
renderSystem->BeginFrame(renderSystem->GetScreenWidth(), renderSystem->GetScreenHeight());
|
||||
|
||||
cvarSystem->SetCVarInteger("vr_eye", eye);
|
||||
|
||||
renderSystem->BeginFrame(renderSystem->GetScreenWidth(), renderSystem->GetScreenHeight());
|
||||
|
||||
// draw everything
|
||||
Draw();
|
||||
|
|
|
@ -456,7 +456,8 @@ void idUsercmdGenLocal::InhibitUsercmd( inhibit_t subsystem, bool inhibit ) {
|
|||
}
|
||||
}
|
||||
|
||||
//extern "C" int Android_GetButton( int key );
|
||||
extern "C" int Android_GetButton( int key );
|
||||
|
||||
/*
|
||||
===============
|
||||
idUsercmdGenLocal::ButtonState
|
||||
|
@ -465,12 +466,11 @@ Returns (the fraction of the frame) that the key was down
|
|||
===============
|
||||
*/
|
||||
int idUsercmdGenLocal::ButtonState( int key ) {
|
||||
return 0;
|
||||
if ( key<0 || key>=UB_MAX_BUTTONS ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//return ( (buttonState[key] > 0) || Android_GetButton(key) ) ? 1 : 0;
|
||||
return ( (buttonState[key] > 0) || Android_GetButton(key) ) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -787,6 +787,7 @@ void idUsercmdGenLocal::MakeCurrent( void ) {
|
|||
// set button bits
|
||||
CmdButtons();
|
||||
|
||||
#if 0
|
||||
// get basic movement from keyboard
|
||||
KeyMove();
|
||||
|
||||
|
@ -795,6 +796,7 @@ void idUsercmdGenLocal::MakeCurrent( void ) {
|
|||
|
||||
// get basic movement from joystick
|
||||
JoystickMove();
|
||||
#endif
|
||||
|
||||
float forward,strafe;
|
||||
float hmd_forward,hmd_strafe;
|
||||
|
@ -1118,7 +1120,7 @@ void idUsercmdGenLocal::MouseState( int *x, int *y, int *button, bool *down ) {
|
|||
*down = mouseDown;
|
||||
}
|
||||
|
||||
//extern "C" int Android_GetNextImpulse();
|
||||
extern "C" int Android_GetNextImpulse();
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -1139,7 +1141,7 @@ usercmd_t idUsercmdGenLocal::GetDirectUsercmd( void ) {
|
|||
// process the system joystick events
|
||||
//Joystick();
|
||||
|
||||
/* int imp = Android_GetNextImpulse();
|
||||
int imp = Android_GetNextImpulse();
|
||||
if( imp )
|
||||
{
|
||||
if ( !Inhibited() ) {
|
||||
|
@ -1149,7 +1151,7 @@ usercmd_t idUsercmdGenLocal::GetDirectUsercmd( void ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// create the usercmd
|
||||
MakeCurrent();
|
||||
|
||||
|
|
|
@ -7102,6 +7102,13 @@ idPlayer::CalculateViewWeaponPos
|
|||
Calculate the bobbing position of the view weapon
|
||||
==============
|
||||
*/
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, float out[2])
|
||||
{
|
||||
out[0] = cosf(DEG2RAD(-rotation)) * x + sinf(DEG2RAD(-rotation)) * y;
|
||||
out[1] = cosf(DEG2RAD(-rotation)) * y - sinf(DEG2RAD(-rotation)) * x;
|
||||
}
|
||||
|
||||
void idPlayer::CalculateViewWeaponPos( idVec3 &origin, idMat3 &axis ) {
|
||||
float scale;
|
||||
float fracsin;
|
||||
|
@ -7112,6 +7119,32 @@ void idPlayer::CalculateViewWeaponPos( idVec3 &origin, idMat3 &axis ) {
|
|||
const idVec3 &viewOrigin = firstPersonViewOrigin;
|
||||
const idMat3 &viewAxis = firstPersonViewAxis;
|
||||
|
||||
if (pVRClientInfo)
|
||||
{
|
||||
angles.pitch = pVRClientInfo->weaponangles[PITCH];
|
||||
angles.yaw = viewAngles.yaw + (pVRClientInfo->weaponangles[YAW] - pVRClientInfo->hmdorientation[YAW]);
|
||||
angles.roll = pVRClientInfo->weaponangles[ROLL];
|
||||
|
||||
axis = angles.ToMat3();
|
||||
|
||||
|
||||
idVec3 gunpos( pVRClientInfo->calculated_weaponoffset[2],
|
||||
pVRClientInfo->calculated_weaponoffset[0],
|
||||
pVRClientInfo->calculated_weaponoffset[1]);
|
||||
|
||||
float r[2];
|
||||
rotateAboutOrigin(gunpos.x, gunpos.y, viewAngles.yaw - pVRClientInfo->hmdorientation[YAW], r);
|
||||
gunpos.x = -r[0];
|
||||
gunpos.y = -r[1];
|
||||
|
||||
gunpos *= cvarSystem->GetCVarFloat( "vr_worldscale" );
|
||||
|
||||
idVec3 gunOfs( g_gun_x.GetFloat(), g_gun_y.GetFloat(), g_gun_z.GetFloat() );
|
||||
origin = viewOrigin + gunpos + (gunOfs * axis);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// these cvars are just for hand tweaking before moving a value to the weapon def
|
||||
idVec3 gunpos( g_gun_x.GetFloat(), g_gun_y.GetFloat(), g_gun_z.GetFloat() );
|
||||
|
||||
|
@ -7245,7 +7278,12 @@ idVec3 idPlayer::GetEyePosition( void ) const {
|
|||
} else {
|
||||
org = GetPhysics()->GetOrigin();
|
||||
}
|
||||
return org + ( GetPhysics()->GetGravityNormal() * -eyeOffset.z );
|
||||
if (pVRClientInfo)
|
||||
{
|
||||
return org + ( GetPhysics()->GetGravityNormal() * (-pVRClientInfo->hmdposition[1] * cvarSystem->GetCVarFloat( "vr_worldscale" )));
|
||||
} else{
|
||||
return org + ( GetPhysics()->GetGravityNormal() * -eyeOffset.z );
|
||||
}
|
||||
}
|
||||
|
||||
void idPlayer::SetVRClientInfo(vr_client_info_t *pVR)
|
||||
|
|
|
@ -702,25 +702,27 @@ void idPlayerView::InfluenceVision( idUserInterface *hud, const renderView_t *vi
|
|||
idPlayerView::RenderPlayerView
|
||||
===================
|
||||
*/
|
||||
static int eye = 0;
|
||||
void idPlayerView::RenderPlayerView( idUserInterface *hud ) {
|
||||
const renderView_t *view = player->GetRenderView();
|
||||
|
||||
{
|
||||
renderView_t *eyeView = view ? new renderView_t(*view) : NULL;
|
||||
|
||||
if (eyeView) {
|
||||
if (eyeView &&
|
||||
!game->InCinematic())
|
||||
{
|
||||
int eye = cvarSystem->GetCVarInteger("vr_eye");
|
||||
if (eye == 0) // left eye
|
||||
{
|
||||
eyeView->vieworg += eyeView->viewaxis[1] * 0.065f * 20.0f;
|
||||
eyeView->vieworg += eyeView->viewaxis[1] *
|
||||
(cvarSystem->GetCVarFloat( "vr_ipd" ) / 2.0f) * cvarSystem->GetCVarFloat( "vr_worldscale" );
|
||||
} else if (eye == 1) // right eye
|
||||
{
|
||||
eyeView->vieworg -= eyeView->viewaxis[1] * 0.065f * 20.0f;
|
||||
eyeView->vieworg -= eyeView->viewaxis[1] *
|
||||
(cvarSystem->GetCVarFloat( "vr_ipd" ) / 2.0f) * cvarSystem->GetCVarFloat( "vr_worldscale" );
|
||||
}
|
||||
}
|
||||
|
||||
eye = 1-eye;
|
||||
|
||||
if (g_skipViewEffects.GetBool()) {
|
||||
SingleView(hud, eyeView);
|
||||
} else {
|
||||
|
|
|
@ -1951,8 +1951,8 @@ void idWeapon::PresentWeapon( bool showViewModel ) {
|
|||
GetGlobalJointTransform( true, barrelJointView, muzzleOrigin, muzzleAxis );
|
||||
} else {
|
||||
// default to going straight out the view
|
||||
muzzleOrigin = playerViewOrigin;
|
||||
muzzleAxis = playerViewAxis;
|
||||
muzzleOrigin = viewWeaponOrigin;// playerViewOrigin;
|
||||
muzzleAxis = viewWeaponAxis;// playerViewAxis;
|
||||
}
|
||||
// spit out a particle
|
||||
if ( !gameLocal.smokeParticles->EmitSmoke( weaponSmoke, weaponSmokeStartTime, gameLocal.random.RandomFloat(), muzzleOrigin, muzzleAxis ) ) {
|
||||
|
@ -2918,7 +2918,10 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
|
|||
for( i = 0; i < num_projectiles; i++ ) {
|
||||
ang = idMath::Sin( spreadRad * gameLocal.random.RandomFloat() );
|
||||
spin = (float)DEG2RAD( 360.0f ) * gameLocal.random.RandomFloat();
|
||||
dir = playerViewAxis[ 0 ] + playerViewAxis[ 2 ] * ( ang * idMath::Sin( spin ) ) - playerViewAxis[ 1 ] * ( ang * idMath::Cos( spin ) );
|
||||
|
||||
//dir = playerViewAxis[ 0 ] + playerViewAxis[ 2 ] * ( ang * idMath::Sin( spin ) ) - playerViewAxis[ 1 ] * ( ang * idMath::Cos( spin ) );
|
||||
dir = viewWeaponAxis[ 0 ] + viewWeaponAxis[ 2 ] * ( ang * idMath::Sin( spin ) ) - viewWeaponAxis[ 1 ] * ( ang * idMath::Cos( spin ) );
|
||||
|
||||
dir.Normalize();
|
||||
|
||||
if ( projectileEnt ) {
|
||||
|
@ -2947,15 +2950,17 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
|
|||
|
||||
// make sure the projectile starts inside the bounding box of the owner
|
||||
if ( i == 0 ) {
|
||||
muzzle_pos = muzzleOrigin + playerViewAxis[ 0 ] * 2.0f;
|
||||
//muzzle_pos = muzzleOrigin + playerViewAxis[ 0 ] * 2.0f;
|
||||
muzzle_pos = muzzleOrigin + viewWeaponAxis[ 0 ] * 2.0f;
|
||||
// DG: sometimes the assertion in idBounds::operator-(const idBounds&) triggers
|
||||
// (would get bounding box with negative volume)
|
||||
// => check that before doing ownerBounds - projBounds (equivalent to the check in the assertion)
|
||||
idVec3 obDiff = ownerBounds[1] - ownerBounds[0];
|
||||
idVec3 pbDiff = projBounds[1] - projBounds[0];
|
||||
bool boundsSubLegal = obDiff.x > pbDiff.x && obDiff.y > pbDiff.y && obDiff.z > pbDiff.z;
|
||||
if ( boundsSubLegal && ( ownerBounds - projBounds ).RayIntersection( muzzle_pos, playerViewAxis[0], distance ) ) {
|
||||
start = muzzle_pos + distance * playerViewAxis[0];
|
||||
if ( boundsSubLegal && ( ownerBounds - projBounds ).RayIntersection( muzzle_pos, viewWeaponAxis[0], distance ) ) {
|
||||
//start = muzzle_pos + distance * playerViewAxis[0];
|
||||
start = muzzle_pos + distance * viewWeaponAxis[0];
|
||||
} else {
|
||||
start = ownerBounds.GetCenter();
|
||||
}
|
||||
|
|
|
@ -336,3 +336,10 @@ idCVar mod_validSkins( "mod_validSkins", "skins/characters/player/marine_mp
|
|||
idCVar net_serverDownload( "net_serverDownload", "0", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "enable server download redirects. 0: off 1: redirect to si_serverURL 2: use builtin download. see net_serverDl cvars for configuration" );
|
||||
idCVar net_serverDlBaseURL( "net_serverDlBaseURL", "", CVAR_GAME | CVAR_ARCHIVE, "base URL for the download redirection" );
|
||||
idCVar net_serverDlTable( "net_serverDlTable", "", CVAR_GAME | CVAR_ARCHIVE, "pak names for which download is provided, separated by ;" );
|
||||
|
||||
|
||||
idCVar vr_ipd( "vr_ipd", "0.065", CVAR_GAME | CVAR_FLOAT | CVAR_ARCHIVE, "VR IPD" );
|
||||
idCVar vr_worldscale( "vr_worldscale", "40.0", CVAR_GAME | CVAR_FLOAT | CVAR_ARCHIVE, "VR World Scale" );
|
||||
idCVar vr_eye( "vr_eye", "0", CVAR_GAME | CVAR_INTEGER, "VR Eye currently being drawn" );
|
||||
|
||||
|
||||
|
|
|
@ -251,6 +251,11 @@ extern idCVar si_spectators;
|
|||
extern idCVar net_clientSelfSmoothing;
|
||||
extern idCVar net_clientLagOMeter;
|
||||
|
||||
//VR CVARS
|
||||
extern idCVar vr_ipd;
|
||||
extern idCVar vr_worldscale;
|
||||
extern idCVar vr_eye;
|
||||
|
||||
extern const char *si_gameTypeArgs[];
|
||||
|
||||
extern const char *ui_skinArgs[];
|
||||
|
|
|
@ -41,7 +41,7 @@ const float PM_SWIMSCALE = 0.5f;
|
|||
const float PM_LADDERSPEED = 100.0f;
|
||||
const float PM_STEPSCALE = 1.0f;
|
||||
|
||||
const float PM_ACCELERATE = 10.0f;
|
||||
const float PM_ACCELERATE = 10000.0f;
|
||||
const float PM_AIRACCELERATE = 1.0f;
|
||||
const float PM_WATERACCELERATE = 4.0f;
|
||||
const float PM_FLYACCELERATE = 8.0f;
|
||||
|
|
|
@ -5,6 +5,145 @@
|
|||
extern "C"
|
||||
{
|
||||
|
||||
static const char *cmd_to_run = NULL;
|
||||
void Android_SetCommand(const char * cmd)
|
||||
{
|
||||
cmd_to_run = cmd;
|
||||
}
|
||||
|
||||
// Can only set one impulse per frame, this should be fine
|
||||
static int nextImpulse = 0;
|
||||
void Android_SetImpuse(int impulse)
|
||||
{
|
||||
nextImpulse = impulse;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
UB_NONE,
|
||||
|
||||
UB_UP,
|
||||
UB_DOWN,
|
||||
UB_LEFT,
|
||||
UB_RIGHT,
|
||||
UB_FORWARD,
|
||||
UB_BACK,
|
||||
UB_LOOKUP,
|
||||
UB_LOOKDOWN,
|
||||
UB_STRAFE,
|
||||
UB_MOVELEFT,
|
||||
UB_MOVERIGHT,
|
||||
|
||||
UB_BUTTON0,
|
||||
UB_BUTTON1,
|
||||
UB_BUTTON2,
|
||||
UB_BUTTON3,
|
||||
UB_BUTTON4,
|
||||
UB_BUTTON5,
|
||||
UB_BUTTON6,
|
||||
UB_BUTTON7,
|
||||
|
||||
UB_ATTACK,
|
||||
UB_SPEED,
|
||||
UB_ZOOM,
|
||||
UB_SHOWSCORES,
|
||||
UB_MLOOK,
|
||||
|
||||
UB_IMPULSE0,
|
||||
UB_IMPULSE1,
|
||||
UB_IMPULSE2,
|
||||
UB_IMPULSE3,
|
||||
UB_IMPULSE4,
|
||||
UB_IMPULSE5,
|
||||
UB_IMPULSE6,
|
||||
UB_IMPULSE7,
|
||||
UB_IMPULSE8,
|
||||
UB_IMPULSE9,
|
||||
UB_IMPULSE10,
|
||||
UB_IMPULSE11,
|
||||
UB_IMPULSE12,
|
||||
UB_IMPULSE13,
|
||||
UB_IMPULSE14,
|
||||
UB_IMPULSE15,
|
||||
UB_IMPULSE16,
|
||||
UB_IMPULSE17,
|
||||
UB_IMPULSE18,
|
||||
UB_IMPULSE19,
|
||||
UB_IMPULSE20,
|
||||
UB_IMPULSE21,
|
||||
UB_IMPULSE22,
|
||||
UB_IMPULSE23,
|
||||
UB_IMPULSE24,
|
||||
UB_IMPULSE25,
|
||||
UB_IMPULSE26,
|
||||
UB_IMPULSE27,
|
||||
UB_IMPULSE28,
|
||||
UB_IMPULSE29,
|
||||
UB_IMPULSE30,
|
||||
UB_IMPULSE31,
|
||||
UB_IMPULSE32,
|
||||
UB_IMPULSE33,
|
||||
UB_IMPULSE34,
|
||||
UB_IMPULSE35,
|
||||
UB_IMPULSE36,
|
||||
UB_IMPULSE37,
|
||||
UB_IMPULSE38,
|
||||
UB_IMPULSE39,
|
||||
UB_IMPULSE40,
|
||||
UB_IMPULSE41,
|
||||
UB_IMPULSE42,
|
||||
UB_IMPULSE43,
|
||||
UB_IMPULSE44,
|
||||
UB_IMPULSE45,
|
||||
UB_IMPULSE46,
|
||||
UB_IMPULSE47,
|
||||
UB_IMPULSE48,
|
||||
UB_IMPULSE49,
|
||||
UB_IMPULSE50,
|
||||
UB_IMPULSE51,
|
||||
UB_IMPULSE52,
|
||||
UB_IMPULSE53,
|
||||
UB_IMPULSE54,
|
||||
UB_IMPULSE55,
|
||||
UB_IMPULSE56,
|
||||
UB_IMPULSE57,
|
||||
UB_IMPULSE58,
|
||||
UB_IMPULSE59,
|
||||
UB_IMPULSE60,
|
||||
UB_IMPULSE61,
|
||||
UB_IMPULSE62,
|
||||
UB_IMPULSE63,
|
||||
|
||||
UB_MAX_BUTTONS
|
||||
} usercmdButton_t;
|
||||
|
||||
static int cmdButtons[UB_MAX_BUTTONS];
|
||||
|
||||
void Android_ButtonChange(int key, int state)
|
||||
{
|
||||
cmdButtons[key] = !!state;
|
||||
}
|
||||
|
||||
int Android_GetButton(int key)
|
||||
{
|
||||
return cmdButtons[key];
|
||||
}
|
||||
|
||||
const char * Android_GetCommand()
|
||||
{
|
||||
// Potential race condition here to miss a command, however extremely unlikely to happen
|
||||
const char *cmd = cmd_to_run;
|
||||
cmd_to_run = NULL;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
int Android_GetNextImpulse()
|
||||
{
|
||||
int impulse = nextImpulse;
|
||||
nextImpulse = 0;
|
||||
return impulse;
|
||||
}
|
||||
|
||||
|
||||
static bool inMenu = false;
|
||||
static bool inGameGuiActive = false;
|
||||
static bool objectiveSystemActive = false;
|
||||
|
|
|
@ -583,7 +583,7 @@ void idRenderSystemLocal::BeginFrame( int windowWidth, int windowHeight ) {
|
|||
cmd = (setBufferCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
|
||||
cmd->commandId = RC_SET_BUFFER;
|
||||
cmd->frameCount = frameCount;
|
||||
cmd->buffer = (int)GL_BACK;
|
||||
cmd->buffer = cvarSystem->GetCVarInteger("vr_eye");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ static void RB_SetBuffer( const void *data ) {
|
|||
// Disabled for OES2
|
||||
//qglDrawBuffer( cmd->buffer );
|
||||
|
||||
GLimp_SetupFrame();
|
||||
GLimp_SetupFrame((int)cmd->buffer);
|
||||
|
||||
|
||||
// clear screen for debugging
|
||||
|
|
|
@ -56,8 +56,6 @@ const float FOG_ENTER = (FOG_ENTER_SIZE+1.0f)/(FOG_ENTER_SIZE*2);
|
|||
|
||||
struct shaderProgram_s;
|
||||
|
||||
extern int stereoSide;
|
||||
|
||||
// idScreenRect gets carried around with each drawSurf, so it makes sense
|
||||
// to keep it compact, instead of just using the idBounds class
|
||||
class idScreenRect {
|
||||
|
@ -497,7 +495,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
renderCommand_t commandId, *next;
|
||||
GLenum buffer;
|
||||
int buffer;
|
||||
int frameCount;
|
||||
} setBufferCommand_t;
|
||||
|
||||
|
@ -1077,7 +1075,7 @@ void GLimp_Shutdown( void );
|
|||
// Destroys the rendering context, closes the window, resets the resolution,
|
||||
// and resets the gamma ramps.
|
||||
|
||||
void GLimp_SetupFrame( void );
|
||||
void GLimp_SetupFrame( int );
|
||||
|
||||
void GLimp_SwapBuffers( void );
|
||||
// Calls the system specific swapbuffers routine, and may also perform
|
||||
|
|
|
@ -748,6 +748,8 @@ void Sys_ClearEvents() {
|
|||
event_list.SetNum(0, false);
|
||||
}
|
||||
|
||||
extern "C" const char * Android_GetCommand();
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_GenerateEvents
|
||||
|
@ -759,13 +761,13 @@ void Sys_GenerateEvents() {
|
|||
if (s)
|
||||
PushConsoleEvent(s);
|
||||
|
||||
/* const char * cmd = Android_GetCommand();
|
||||
const char * cmd = Android_GetCommand();
|
||||
if(cmd)
|
||||
{
|
||||
cmdSystem->BufferCommandText( CMD_EXEC_NOW, cmd );
|
||||
//cmdSystem->BufferCommandText( CMD_EXEC_NOW, "\n" );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//SDL_PumpEvents();
|
||||
}
|
||||
|
|
|
@ -140,11 +140,11 @@ void GLimp_Shutdown() {
|
|||
}
|
||||
|
||||
int stereoSide = 0;
|
||||
|
||||
void GLimp_SetupFrame() {
|
||||
void GLimp_SetupFrame(int eye) {
|
||||
|
||||
//Only do this if we have drawn both buffers and are back to the first buffer
|
||||
if (stereoSide == 0) {
|
||||
stereoSide = eye;
|
||||
if (eye == 0) {
|
||||
Doom3Quest_processMessageQueue();
|
||||
|
||||
Doom3Quest_prepareEyeBuffer(0);
|
||||
|
@ -163,7 +163,6 @@ void GLimp_SwapBuffers() {
|
|||
{
|
||||
Doom3Quest_finishEyeBuffer(0);
|
||||
Doom3Quest_prepareEyeBuffer(1);
|
||||
stereoSide = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -171,9 +170,6 @@ void GLimp_SwapBuffers() {
|
|||
|
||||
//We can now submit the stereo frame
|
||||
Doom3Quest_submitFrame();
|
||||
|
||||
//Reset for next time
|
||||
stereoSide = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue