various changes

This commit is contained in:
Simon 2020-03-14 12:11:18 +00:00
parent 7970e5fce1
commit 1ba20da2de
9 changed files with 58 additions and 48 deletions

View file

@ -63,6 +63,8 @@ vec3_t offhandangles;
vec3_t offhandoffset;
bool player_moving;
bool disable_clock_gettime;
#if !defined( EGL_OPENGL_ES3_BIT_KHR )
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
@ -833,7 +835,7 @@ bool isMultiplayer()
/*
========================
Android_Vibrate
VR_Vibrate
========================
*/
@ -841,7 +843,7 @@ Android_Vibrate
float vibration_channel_duration[2] = {0.0f, 0.0f};
float vibration_channel_intensity[2] = {0.0f, 0.0f};
void Android_Vibrate( float duration, int channel, float intensity )
void VR_Vibrate( float duration, int channel, float intensity )
{
if (vibration_channel_duration[channel] > 0.0f)
return;
@ -1242,7 +1244,7 @@ int m_height;
//qboolean R_SetMode( void );
void Android_GetScreenRes(uint32_t *width, uint32_t *height)
void VR_GetScreenRes(uint32_t *width, uint32_t *height)
{
*width = m_width;
*height = m_height;
@ -1267,6 +1269,8 @@ void VR_Init()
positional_movementForward = 0.0f;
snapTurn = 90.0f; // start partly turned
disable_clock_gettime = false;
//init randomiser
srand(time(NULL));

View file

@ -71,7 +71,9 @@ void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out);
void QuatToYawPitchRoll(ovrQuatf q, float pitchAdjust, vec3_t out);
bool useScreenLayer();
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key);
void Android_GetScreenRes(uint32_t *width, uint32_t *height);
void VR_GetScreenRes(uint32_t *width, uint32_t *height);
void VR_Vibrate( float duration, int channel, float intensity );
void C_DoCommandC (const char *cmd);

View file

@ -22,15 +22,13 @@ int isMenuActive();
void Joy_GenerateButtonEvents(int oldbuttons, int newbuttons, int numbuttons, int base);
extern bool forceVirtualScreen;
extern bool disable_clock_gettime;
void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTracking* pOffTracking,
int domButton1, int domButton2, int offButton1, int offButton2 )
{
static bool dominantGripPushed = false;
//Show screen view - for testing
if (((pOffTrackedRemoteNew->Buttons & offButton2) !=
(pOffTrackedRemoteOld->Buttons & offButton2)) &&
@ -39,6 +37,14 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
forceVirtualScreen = !forceVirtualScreen;
}
//Toggle the get time function for testing
if (((pOffTrackedRemoteNew->Buttons & offButton1) !=
(pOffTrackedRemoteOld->Buttons & offButton1)) &&
(pOffTrackedRemoteNew->Buttons & offButton1)) {
disable_clock_gettime = !disable_clock_gettime;
}
//Menu button
handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, KEY_ESCAPE);
@ -240,9 +246,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Now handle all the buttons
{
//Dominant Grip works like a shift key
bool dominantGripPushedOld = (pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0;
bool dominantGripPushedNew = (pDominantTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0;
bool dominantGripPushedOld = (pDominantTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0;
bool dominantGripPushedNew = (pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0;
//Weapon Chooser
static int itemSwitched = 0;
@ -253,23 +258,33 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
if (itemSwitched == 0) {
if (between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f))
{
C_DoCommandC("+nextweap");
Joy_GenerateButtonEvents(0, 1, 1, KEY_MWHEELDOWN);
itemSwitched = 1;
}
else
{
C_DoCommandC("+prevweap");
Joy_GenerateButtonEvents(0, 1, 1, KEY_MWHEELUP);
itemSwitched = 2;
}
}
else if (itemSwitched == 1)
{
Joy_GenerateButtonEvents(1, 0, 1, KEY_MWHEELDOWN);
itemSwitched = 0;
}
else if (itemSwitched == 2)
{
Joy_GenerateButtonEvents(1, 0, 1, KEY_MWHEELUP);
itemSwitched = 0;
}
} else {
if (itemSwitched == 1)
{
C_DoCommandC("-nextweap");
Joy_GenerateButtonEvents(1, 0, 1, KEY_MWHEELDOWN);
}
else if (itemSwitched == 2)
{
C_DoCommandC("-prevweap");
Joy_GenerateButtonEvents(1, 0, 1, KEY_MWHEELUP);
}
itemSwitched = 0;
}

View file

@ -5,7 +5,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := qzdoom
LOCAL_CFLAGS := -D__MOBILE__ -DNO_PIX_BUFF -DOPNMIDI_DISABLE_GX_EMULATOR -DGZDOOM -DLZDOOM -DUSE_GL_HW_BUFFERS -DNO_CLOCK_GETTIME -DNO_VBO -D__STDINT_LIMITS -DENGINE_NAME=\"lzdoom\"
LOCAL_CFLAGS := -D__MOBILE__ -DNO_PIX_BUFF -DOPNMIDI_DISABLE_GX_EMULATOR -DGZDOOM -DLZDOOM -DUSE_GL_HW_BUFFERS -DNO_VBO -D__STDINT_LIMITS -DENGINE_NAME=\"lzdoom\"
LOCAL_CPPFLAGS := -DHAVE_FLUIDSYNTH -DHAVE_MPG123 -DHAVE_SNDFILE -std=c++14 -DHAVE_JWZGLES -Wno-inconsistent-missing-override -Werror=format-security -fexceptions -fpermissive -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D__forceinline=inline -DNO_GTK -DNO_SSE -fsigned-char

View file

@ -287,7 +287,7 @@ namespace s3d
eye_ptrs.Push(&rightEyeView);
//Get this from my code
Android_GetScreenRes(&sceneWidth, &sceneHeight);
VR_GetScreenRes(&sceneWidth, &sceneHeight);
leftEyeView.initialize();
rightEyeView.initialize();
@ -410,7 +410,7 @@ namespace s3d
if (gamestate == GS_LEVEL && !isMenuActive()) {
cachedScreenBlocks = screenblocks;
screenblocks = 12; // always be full-screen during 3D scene render
screenblocks = 12;
setUseScreenLayer(false);
}
else {

View file

@ -316,7 +316,7 @@ void NoSDLGLFB::SwapBuffers()
int NoSDLGLFB::GetClientWidth()
{
uint32_t w, h;
Android_GetScreenRes(&w, &h);
VR_GetScreenRes(&w, &h);
int width = w;
return width;
}
@ -324,7 +324,7 @@ int NoSDLGLFB::GetClientWidth()
int NoSDLGLFB::GetClientHeight()
{
uint32_t w, h;
Android_GetScreenRes(&w, &h);
VR_GetScreenRes(&w, &h);
int height = h;
return height;
}
@ -332,7 +332,7 @@ int NoSDLGLFB::GetClientHeight()
void NoSDLGLFB::ScaleCoordsFromWindow(int16_t &x, int16_t &y)
{
uint32_t w, h;
Android_GetScreenRes(&w, &h);
VR_GetScreenRes(&w, &h);
// Detect if we're doing scaling in the Window and adjust the mouse
// coordinates accordingly. This could be more efficent, but I

View file

@ -232,7 +232,7 @@ void NoSDLFB::SetVSync (bool vsync)
void NoSDLFB::ScaleCoordsFromWindow(int16_t &x, int16_t &y)
{
uint32_t w, h;
Android_GetScreenRes(&w, &h);
VR_GetScreenRes(&w, &h);
// Detect if we're doing scaling in the Window and adjust the mouse

View file

@ -38,22 +38,10 @@
#if !defined _WIN32 && !defined __APPLE__
#ifdef NO_CLOCK_GETTIME
class cycle_t
{
public:
cycle_t &operator= (const cycle_t &o) { return *this; }
void Reset() {}
void Clock() {}
void Unclock() {}
double Time() { return 0; }
double TimeMS() { return 0; }
};
#else
#include <time.h>
extern bool disable_clock_gettime;
class cycle_t
{
public:
@ -64,18 +52,21 @@ public:
void Clock()
{
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
Sec -= ts.tv_sec + ts.tv_nsec * 1e-9;
if (!disable_clock_gettime) {
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
Sec -= ts.tv_sec + ts.tv_nsec * 1e-9;
}
}
void Unclock()
{
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
Sec += ts.tv_sec + ts.tv_nsec * 1e-9;
void Unclock() {
if (!disable_clock_gettime) {
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
Sec += ts.tv_sec + ts.tv_nsec * 1e-9;
}
}
double Time()
@ -92,8 +83,6 @@ private:
double Sec;
};
#endif
#else
// Windows and macOS

View file

@ -1529,7 +1529,7 @@ void V_Init (bool restart)
if (height == 0)
{
uint32_t uWidth, uHeight;
Android_GetScreenRes(&uWidth, &uHeight);
VR_GetScreenRes(&uWidth, &uHeight);
width = uWidth;
height = uHeight;
}