mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-25 05:21:00 +00:00
Mouse working in main menu
and game library loads, intro plays, but crashing in a sequence atm
This commit is contained in:
parent
9627464541
commit
b1d847e0d8
9 changed files with 66 additions and 33 deletions
|
@ -215,19 +215,9 @@ float clamp(float _min, float _val, float _max)
|
||||||
}
|
}
|
||||||
|
|
||||||
void interactWithTouchScreen(bool reset, ovrInputStateTrackedRemote *newState, ovrInputStateTrackedRemote *oldState) {
|
void interactWithTouchScreen(bool reset, ovrInputStateTrackedRemote *newState, ovrInputStateTrackedRemote *oldState) {
|
||||||
static float cursorX = 0.25f;
|
|
||||||
static float cursorY = 0.125f;
|
|
||||||
|
|
||||||
if (reset)
|
float cursorX = (float)(-vr.weaponangles[YAW] / 90.0) + 0.5f;
|
||||||
{
|
float cursorY = (float)(vr.weaponangles[PITCH] / 90.0) + 0.5f;
|
||||||
cursorX = 0.25f;
|
|
||||||
cursorY = 0.125f;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursorX += (float)(vr.weaponangles_delta[YAW] / 180.0);
|
|
||||||
cursorX = clamp(0.0, cursorX, 0.5);
|
|
||||||
cursorY += (float)(-vr.weaponangles_delta[PITCH] / 220.0);
|
|
||||||
cursorY = clamp(0.0, cursorY, 0.4);
|
|
||||||
|
|
||||||
PortableMouseAbs(cursorX, cursorY);
|
PortableMouseAbs(cursorX, cursorY);
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@ LOCAL_LDLIBS := $(JK3_BASE_LDLIBS)
|
||||||
|
|
||||||
LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -ldl -llog
|
LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -ldl -llog
|
||||||
LOCAL_STATIC_LIBRARIES := libpng libjpeg
|
LOCAL_STATIC_LIBRARIES := libpng libjpeg
|
||||||
# LOCAL_SHARED_LIBRARIES := gl4es
|
LOCAL_SHARED_LIBRARIES := gl4es
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(SUPPORT_LIBS)/libpng $(TOP_DIR) $(SPDir)/rd-vanilla $(SPDir)/rd-common
|
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(SUPPORT_LIBS)/libpng $(TOP_DIR) $(SPDir)/rd-vanilla $(SPDir)/rd-common
|
||||||
|
|
||||||
|
|
|
@ -749,7 +749,6 @@ void *Sys_LoadGameDll( const char *name, void *(QDECL **moduleAPI)(int, ...) )
|
||||||
char *fn;
|
char *fn;
|
||||||
char filename[MAX_OSPATH];
|
char filename[MAX_OSPATH];
|
||||||
|
|
||||||
//Com_sprintf (filename, sizeof(filename), "%s" ARCH_STRING DLL_EXT, name);
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
libHandle = Sys_LoadLibrary( filename );
|
libHandle = Sys_LoadLibrary( filename );
|
||||||
|
@ -762,6 +761,7 @@ void *Sys_LoadGameDll( const char *name, void *(QDECL **moduleAPI)(int, ...) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Com_sprintf (filename, sizeof(filename), "%s" ARCH_STRING DLL_EXT, name);
|
||||||
char lib_path[512];
|
char lib_path[512];
|
||||||
char *libdir = (char*)getenv("JK_LIBDIR");
|
char *libdir = (char*)getenv("JK_LIBDIR");
|
||||||
sprintf(lib_path,"%s/lib%s", libdir,filename);
|
sprintf(lib_path,"%s/lib%s", libdir,filename);
|
||||||
|
@ -864,12 +864,11 @@ void *Sys_LoadSPGameDll( const char *name, GetGameAPIProc **GetGameAPI )
|
||||||
assert( GetGameAPI );
|
assert( GetGameAPI );
|
||||||
|
|
||||||
Com_sprintf (filename, sizeof(filename), "%s" ARCH_STRING DLL_EXT, name);
|
Com_sprintf (filename, sizeof(filename), "%s" ARCH_STRING DLL_EXT, name);
|
||||||
|
char lib_path[512];
|
||||||
|
char *libdir = (char*)getenv("JK_LIBDIR");
|
||||||
|
sprintf(lib_path,"%s/lib%s", libdir,filename);
|
||||||
|
libHandle = dlopen (lib_path, RTLD_LAZY );
|
||||||
|
|
||||||
#if defined(MACOS_X) && !defined(_JK2EXE)
|
|
||||||
//First, look for the old-style mac .bundle that's inside a pk3
|
|
||||||
//It's actually zipped, and the zipfile has the same name as 'name'
|
|
||||||
libHandle = Sys_LoadMachOBundle( filename );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!libHandle) {
|
if (!libHandle) {
|
||||||
char *basepath = Cvar_VariableString( "fs_basepath" );
|
char *basepath = Cvar_VariableString( "fs_basepath" );
|
||||||
|
@ -881,10 +880,8 @@ void *Sys_LoadSPGameDll( const char *name, GetGameAPIProc **GetGameAPI )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *searchPaths[] = {
|
const char *searchPaths[] = {
|
||||||
|
libdir,
|
||||||
homepath,
|
homepath,
|
||||||
#ifdef MACOS_X
|
|
||||||
apppath,
|
|
||||||
#endif
|
|
||||||
basepath,
|
basepath,
|
||||||
cdpath,
|
cdpath,
|
||||||
};
|
};
|
||||||
|
|
|
@ -221,7 +221,6 @@ void PortableMouse(float dx,float dy)
|
||||||
mdx += dx;
|
mdx += dx;
|
||||||
mdy += dy;
|
mdy += dy;
|
||||||
|
|
||||||
|
|
||||||
//Sys_QueEvent( t, SE_MOUSE, mx, my, 0, NULL );
|
//Sys_QueEvent( t, SE_MOUSE, mx, my, 0, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,11 +228,13 @@ int absx=0,absy=0;
|
||||||
void JKVR_GetScreenRes(int *width, int *height);
|
void JKVR_GetScreenRes(int *width, int *height);
|
||||||
void PortableMouseAbs(float x,float y)
|
void PortableMouseAbs(float x,float y)
|
||||||
{
|
{
|
||||||
int width;
|
//int width;
|
||||||
int height;
|
//int height;
|
||||||
JKVR_GetScreenRes(&width, &height);
|
//JKVR_GetScreenRes(&width, &height);
|
||||||
absx = x * width;
|
absx = x * 640;
|
||||||
absy = y * height;
|
absy = y * 480;
|
||||||
|
|
||||||
|
CL_MouseEvent(absx, absy, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1378,7 +1378,7 @@ void CFxScheduler::AddScheduledEffects( bool portal )
|
||||||
CreateEffect( effect->mpTemplate, effect->mClientID,
|
CreateEffect( effect->mpTemplate, effect->mClientID,
|
||||||
theFxHelper.mTime - effect->mStartTime );
|
theFxHelper.mTime - effect->mStartTime );
|
||||||
}
|
}
|
||||||
else if (effect->mBoltNum == -1)
|
else if (effect->mBoltNum == (char)-1)
|
||||||
{// normal effect
|
{// normal effect
|
||||||
if ( effect->mEntNum != -1 ) // -1
|
if ( effect->mEntNum != -1 ) // -1
|
||||||
{
|
{
|
||||||
|
@ -1397,7 +1397,7 @@ void CFxScheduler::AddScheduledEffects( bool portal )
|
||||||
else
|
else
|
||||||
{ //bolted on effect
|
{ //bolted on effect
|
||||||
// do we need to go and re-get the bolt matrix again? Since it takes time lets try to do it only once
|
// do we need to go and re-get the bolt matrix again? Since it takes time lets try to do it only once
|
||||||
if ((effect->mModelNum != oldModelNum) || (effect->mEntNum != oldEntNum) || (effect->mBoltNum != oldBoltIndex))
|
if ((effect->mModelNum != oldModelNum) || (effect->mEntNum != oldEntNum) || (effect->mBoltNum != (char)oldBoltIndex))
|
||||||
{
|
{
|
||||||
const centity_t ¢ = cg_entities[effect->mEntNum];
|
const centity_t ¢ = cg_entities[effect->mEntNum];
|
||||||
if (cent.gent->ghoul2.IsValid())
|
if (cent.gent->ghoul2.IsValid())
|
||||||
|
|
|
@ -438,14 +438,19 @@ void CL_KeyMove( usercmd_t *cmd ) {
|
||||||
cmd->upmove = ClampChar( up );
|
cmd->upmove = ClampChar( up );
|
||||||
}
|
}
|
||||||
|
|
||||||
void _UI_MouseEvent( int dx, int dy );
|
void _UI_MouseEventAbs( int x, int y );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
CL_MouseEvent
|
CL_MouseEvent
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_MouseEvent( int dx, int dy, int time ) {
|
void CL_MouseEvent( int x, int y, int time ) {
|
||||||
|
if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
|
||||||
|
_UI_MouseEventAbs( x, y );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
|
if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
|
||||||
_UI_MouseEvent( dx, dy );
|
_UI_MouseEvent( dx, dy );
|
||||||
}
|
}
|
||||||
|
@ -453,6 +458,7 @@ void CL_MouseEvent( int dx, int dy, int time ) {
|
||||||
cl.mouseDx[cl.mouseIndex] += dx;
|
cl.mouseDx[cl.mouseIndex] += dx;
|
||||||
cl.mouseDy[cl.mouseIndex] += dy;
|
cl.mouseDy[cl.mouseIndex] += dy;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -779,7 +779,7 @@ static void InitOpenGL( void )
|
||||||
|
|
||||||
// set default state
|
// set default state
|
||||||
GL_SetDefaultState();
|
GL_SetDefaultState();
|
||||||
R_Splash(); //get something on screen asap
|
//R_Splash(); //get something on screen asap
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,6 +212,7 @@ extern uiInfo_t uiInfo;
|
||||||
void _UI_Init( qboolean inGameLoad );
|
void _UI_Init( qboolean inGameLoad );
|
||||||
void _UI_DrawRect( float x, float y, float width, float height, float size, const float *color );
|
void _UI_DrawRect( float x, float y, float width, float height, float size, const float *color );
|
||||||
void _UI_MouseEvent( int dx, int dy );
|
void _UI_MouseEvent( int dx, int dy );
|
||||||
|
void _UI_MouseEventAbs( int x, int y );
|
||||||
void _UI_KeyEvent( int key, qboolean down );
|
void _UI_KeyEvent( int key, qboolean down );
|
||||||
void UI_Report(void);
|
void UI_Report(void);
|
||||||
|
|
||||||
|
|
|
@ -4037,6 +4037,44 @@ void _UI_MouseEvent( int dx, int dy )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
UI_MouseEventAbs
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
//JLFMOUSE CALLED EACH FRAME IN UI
|
||||||
|
void _UI_MouseEventAbs( int x, int y )
|
||||||
|
{
|
||||||
|
// update mouse screen position
|
||||||
|
uiInfo.uiDC.cursorx = x;
|
||||||
|
if (uiInfo.uiDC.cursorx < 0)
|
||||||
|
{
|
||||||
|
uiInfo.uiDC.cursorx = 0;
|
||||||
|
}
|
||||||
|
else if (uiInfo.uiDC.cursorx > SCREEN_WIDTH)
|
||||||
|
{
|
||||||
|
uiInfo.uiDC.cursorx = SCREEN_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiInfo.uiDC.cursory = y;
|
||||||
|
if (uiInfo.uiDC.cursory < 0)
|
||||||
|
{
|
||||||
|
uiInfo.uiDC.cursory = 0;
|
||||||
|
}
|
||||||
|
else if (uiInfo.uiDC.cursory > SCREEN_HEIGHT)
|
||||||
|
{
|
||||||
|
uiInfo.uiDC.cursory = SCREEN_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Menu_Count() > 0)
|
||||||
|
{
|
||||||
|
//menuDef_t *menu = Menu_GetFocused();
|
||||||
|
//Menu_HandleMouseMove(menu, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory);
|
||||||
|
Display_MouseMove(NULL, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
UI_KeyEvent
|
UI_KeyEvent
|
||||||
|
|
Loading…
Reference in a new issue