Mouse working in main menu

and game library loads, intro plays, but crashing in a sequence atm
This commit is contained in:
Simon 2022-09-23 23:10:32 +01:00
parent 9627464541
commit b1d847e0d8
9 changed files with 66 additions and 33 deletions

View file

@ -215,19 +215,9 @@ float clamp(float _min, float _val, float _max)
}
void interactWithTouchScreen(bool reset, ovrInputStateTrackedRemote *newState, ovrInputStateTrackedRemote *oldState) {
static float cursorX = 0.25f;
static float cursorY = 0.125f;
if (reset)
{
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);
float cursorX = (float)(-vr.weaponangles[YAW] / 90.0) + 0.5f;
float cursorY = (float)(vr.weaponangles[PITCH] / 90.0) + 0.5f;
PortableMouseAbs(cursorX, cursorY);
}

View file

@ -16,7 +16,7 @@ LOCAL_LDLIBS := $(JK3_BASE_LDLIBS)
LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -ldl -llog
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

View file

@ -749,7 +749,6 @@ void *Sys_LoadGameDll( const char *name, void *(QDECL **moduleAPI)(int, ...) )
char *fn;
char filename[MAX_OSPATH];
//Com_sprintf (filename, sizeof(filename), "%s" ARCH_STRING DLL_EXT, name);
#if 0
libHandle = Sys_LoadLibrary( filename );
@ -762,6 +761,7 @@ void *Sys_LoadGameDll( const char *name, void *(QDECL **moduleAPI)(int, ...) )
#endif
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);
@ -864,12 +864,11 @@ void *Sys_LoadSPGameDll( const char *name, GetGameAPIProc **GetGameAPI )
assert( GetGameAPI );
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) {
char *basepath = Cvar_VariableString( "fs_basepath" );
@ -881,10 +880,8 @@ void *Sys_LoadSPGameDll( const char *name, GetGameAPIProc **GetGameAPI )
#endif
const char *searchPaths[] = {
libdir,
homepath,
#ifdef MACOS_X
apppath,
#endif
basepath,
cdpath,
};

View file

@ -221,7 +221,6 @@ void PortableMouse(float dx,float dy)
mdx += dx;
mdy += dy;
//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 PortableMouseAbs(float x,float y)
{
int width;
int height;
JKVR_GetScreenRes(&width, &height);
absx = x * width;
absy = y * height;
//int width;
//int height;
//JKVR_GetScreenRes(&width, &height);
absx = x * 640;
absy = y * 480;
CL_MouseEvent(absx, absy, 0);
}

View file

@ -1378,7 +1378,7 @@ void CFxScheduler::AddScheduledEffects( bool portal )
CreateEffect( effect->mpTemplate, effect->mClientID,
theFxHelper.mTime - effect->mStartTime );
}
else if (effect->mBoltNum == -1)
else if (effect->mBoltNum == (char)-1)
{// normal effect
if ( effect->mEntNum != -1 ) // -1
{
@ -1397,7 +1397,7 @@ void CFxScheduler::AddScheduledEffects( bool portal )
else
{ //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
if ((effect->mModelNum != oldModelNum) || (effect->mEntNum != oldEntNum) || (effect->mBoltNum != oldBoltIndex))
if ((effect->mModelNum != oldModelNum) || (effect->mEntNum != oldEntNum) || (effect->mBoltNum != (char)oldBoltIndex))
{
const centity_t &cent = cg_entities[effect->mEntNum];
if (cent.gent->ghoul2.IsValid())

View file

@ -438,14 +438,19 @@ void CL_KeyMove( usercmd_t *cmd ) {
cmd->upmove = ClampChar( up );
}
void _UI_MouseEvent( int dx, int dy );
void _UI_MouseEventAbs( int x, int y );
/*
=================
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 ) {
_UI_MouseEvent( dx, dy );
}
@ -453,6 +458,7 @@ void CL_MouseEvent( int dx, int dy, int time ) {
cl.mouseDx[cl.mouseIndex] += dx;
cl.mouseDy[cl.mouseIndex] += dy;
}
*/
}
/*

View file

@ -779,7 +779,7 @@ static void InitOpenGL( void )
// set default state
GL_SetDefaultState();
R_Splash(); //get something on screen asap
//R_Splash(); //get something on screen asap
}
else
{

View file

@ -212,6 +212,7 @@ extern uiInfo_t uiInfo;
void _UI_Init( qboolean inGameLoad );
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_MouseEventAbs( int x, int y );
void _UI_KeyEvent( int key, qboolean down );
void UI_Report(void);

View file

@ -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