Number of small tweaks

including world scale
This commit is contained in:
Simon 2022-10-04 22:48:30 +01:00
parent 581b8829af
commit 3826eb86c4
17 changed files with 75 additions and 197 deletions

View file

@ -1280,7 +1280,7 @@ void JKVR_Init()
vr_control_scheme = Cvar_Get( "vr_control_scheme", "0", CVAR_ARCHIVE);
vr_switch_sticks = Cvar_Get( "vr_switch_sticks", "0", CVAR_ARCHIVE);
vr_immersive_cinematics = Cvar_Get("vr_immersive_cinematics", "1", CVAR_ARCHIVE);
vr_immersive_cinematics = Cvar_Get("vr_immersive_cinematics", "0", CVAR_ARCHIVE);
vr_screen_dist = Cvar_Get( "vr_screen_dist", "2.5", CVAR_ARCHIVE);
}
@ -1607,7 +1607,7 @@ void JKVR_getHMDOrientation() {//Get orientation
updateHMDOrientation();
ALOGV(" HMD-Position: %f, %f, %f", positionHmd.x, positionHmd.y, positionHmd.z);
///ALOGV(" HMD-Position: %f, %f, %f", positionHmd.x, positionHmd.y, positionHmd.z);
}
void shutdownVR() {

View file

@ -48,7 +48,8 @@ typedef struct {
bool hasbinoculars;
bool velocitytriggered;
float swingvelocity;
float primaryswingvelocity;
float secondaryswingvelocity;
vec3_t offhandangles;
vec3_t offhandangles_last; // Don't use this, it is just for calculating delta!

View file

@ -210,7 +210,12 @@ float clamp(float _min, float _val, float _max)
void interactWithTouchScreen(bool reset, ovrInputStateTrackedRemote *newState, ovrInputStateTrackedRemote *oldState) {
float cursorX = (float)(-vr.weaponangles[YAW] / 90.0) + 0.5f;
static float centerYaw = 0;
if (reset || fabs(sinf(DEG2RAD(vr.weaponangles[YAW]-centerYaw))) > 0.5f)
{
centerYaw = vr.weaponangles[YAW];
}
float cursorX = -sinf(DEG2RAD(vr.weaponangles[YAW]-centerYaw)) + 0.5f;
float cursorY = (float)(vr.weaponangles[PITCH] / 90.0) + 0.5f;
PortableMouseAbs(cursorX, cursorY);

View file

@ -110,8 +110,8 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
VectorSubtract(vr.weaponangles_last, vr.weaponangles, vr.weaponangles_delta);
VectorCopy(vr.weaponangles, vr.weaponangles_last);
ALOGV(" weaponangles_last: %f, %f, %f",
vr.weaponangles_last[0], vr.weaponangles_last[1], vr.weaponangles_last[2]);
// ALOGV(" weaponangles_last: %f, %f, %f",
// vr.weaponangles_last[0], vr.weaponangles_last[1], vr.weaponangles_last[2]);
//GB Also set offhand angles just in case we want to use those.
vec3_t rotation_off = {0};
@ -222,30 +222,56 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
vr.weaponoffset[2] = pWeapon->HeadPose.Pose.Position.z - vr.hmdposition[2];
vr.weaponoffset_timestamp = Sys_Milliseconds( );
vr.swingvelocity = sqrtf(powf(pWeapon->HeadPose.LinearVelocity.x, 2) +
vr.primaryswingvelocity = sqrtf(powf(pWeapon->HeadPose.LinearVelocity.x, 2) +
powf(pWeapon->HeadPose.LinearVelocity.y, 2) +
powf(pWeapon->HeadPose.LinearVelocity.z, 2));
vr.secondaryswingvelocity = sqrtf(powf(pOff->HeadPose.LinearVelocity.x, 2) +
powf(pOff->HeadPose.LinearVelocity.y, 2) +
powf(pOff->HeadPose.LinearVelocity.z, 2));
//Does weapon velocity trigger attack (knife) and is it fast enough
static bool velocityTriggeredAttack = false;
if (vr.velocitytriggered)
{
static bool fired = qfalse;
velocityTriggeredAttack = (vr.swingvelocity > VELOCITY_TRIGGER);
if (fired != velocityTriggeredAttack) {
ALOGV("**WEAPON EVENT** veocity triggered %s", velocityTriggeredAttack ? "+attack" : "-attack");
sendButtonAction("+attack", velocityTriggeredAttack);
fired = velocityTriggeredAttack;
//We don't allow the saber to be velocity triggered
if (vr.weaponid != WP_SABER) {
//Does weapon velocity trigger attack (melee) and is it fast enough
static bool primaryVelocityTriggeredAttack = false;
if (vr.velocitytriggered) {
static bool fired = qfalse;
primaryVelocityTriggeredAttack = (vr.primaryswingvelocity > VELOCITY_TRIGGER);
if (fired != primaryVelocityTriggeredAttack) {
ALOGV("**WEAPON EVENT** veocity triggered %s",
primaryVelocityTriggeredAttack ? "+altattack" : "-altattack");
//normal attack is a punch with the left hand
sendButtonAction("+altattack", primaryVelocityTriggeredAttack);
fired = primaryVelocityTriggeredAttack;
}
} else if (primaryVelocityTriggeredAttack) {
//send a stop attack as we have an unfinished velocity attack
primaryVelocityTriggeredAttack = qfalse;
ALOGV("**WEAPON EVENT** veocity triggered -altattack");
sendButtonAction("+altattack", primaryVelocityTriggeredAttack);
}
static bool secondaryVelocityTriggeredAttack = false;
if (vr.velocitytriggered) {
static bool fired = qfalse;
secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity >
VELOCITY_TRIGGER);
if (fired != secondaryVelocityTriggeredAttack) {
ALOGV("**WEAPON EVENT** veocity triggered %s",
secondaryVelocityTriggeredAttack ? "+attack" : "-attack");
//normal attack is a punch with the left hand
sendButtonAction("+attack", secondaryVelocityTriggeredAttack);
fired = secondaryVelocityTriggeredAttack;
}
} else if (secondaryVelocityTriggeredAttack) {
//send a stop attack as we have an unfinished velocity attack
secondaryVelocityTriggeredAttack = qfalse;
ALOGV("**WEAPON EVENT** veocity triggered -attack");
sendButtonAction("+attack", secondaryVelocityTriggeredAttack);
}
}
else if (velocityTriggeredAttack)
{
//send a stop attack as we have an unfinished velocity attack
velocityTriggeredAttack = qfalse;
ALOGV("**WEAPON EVENT** veocity triggered -attack");
sendButtonAction("+attack", velocityTriggeredAttack);
}
if (vr.weapon_stabilised)
@ -399,7 +425,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
if (dominantGripPushTime == 0) {
dominantGripPushTime = GetTimeInMilliSeconds();
}
Cvar_Set("timescale", "0.1");
Cvar_Set("timescale", "0.25");
}
else
{

View file

@ -48,162 +48,6 @@ char *Sys_ConsoleInput(void)
return CON_Input( );
}
#if defined( DO_LOADDLL_WRAP )
void *Sys_LoadDll_Wrapped( const char *name,
int( **entryPoint ) ( int, ... ),
int ( *systemcalls )( int, ... ) )
#else
void *Sys_LoadDll( const char *name)
#endif
{
void *libHandle;
//void ( *dllEntry )( intptr_t ( *syscallptr )( intptr_t, ... ) );
char fname[MAX_OSPATH];
char *homepath;
char *basepath;
char *pwdpath;
char *gamedir;
char *fn;
const char* err = NULL; // bk001206 // rb0101023 - now const
// bk001206 - let's have some paranoia
assert( name );
snprintf( fname, sizeof( fname ), "../%sarm.so", name );
// bk001129 - was RTLD_LAZY
#define Q_RTLD RTLD_NOW
homepath = Cvar_VariableString( "fs_homepath" );
basepath = Cvar_VariableString( "fs_basepath" );
gamedir = Cvar_VariableString( "fs_game" );
pwdpath = Sys_Cwd();
fn = FS_BuildOSPath( pwdpath, gamedir, fname );
// bk001206 - verbose
Com_Printf( "Sys_LoadDll(%s)... ", fn );
#ifdef __ANDROID__
char path[500];
char *libdir = (char*)getenv("RTCW_GAMELIBDIR");
#ifdef WOLF_SP_DEMO
snprintf( path, sizeof( path ), "%s/lib%sarm_d.so", getLibPath(), name );
#else
snprintf( path, sizeof( path ), "%s/lib%sarm.so", libdir, name );
#endif
//LOGI("Trying to load Android lib: %s",path);
libHandle = dlopen (path, RTLD_LAZY );
#else
// bk001129 - from cvs1.17 (mkv), was fname not fn
libHandle = dlopen( fn, Q_RTLD );
#endif
if ( !libHandle ) {
Com_Printf( "failed (%s)\n", dlerror() );
// homepath
fn = FS_BuildOSPath( homepath, gamedir, fname );
Com_Printf( "Sys_LoadDll(%s)... ", fn );
libHandle = dlopen( fn, Q_RTLD );
if ( !libHandle ) {
Com_Printf( "failed (%s)\n", dlerror() );
// basepath
fn = FS_BuildOSPath( basepath, gamedir, fname );
Com_Printf( "Sys_LoadDll(%s)... ", fn );
libHandle = dlopen( fn, Q_RTLD );
if ( !libHandle ) {
Com_Printf( "failed (%s)\n", dlerror() );
if ( strlen( gamedir ) && Q_stricmp( gamedir, BASEGAME ) ) { // begin BASEGAME != fs_game section
// media-only mods: no DLL whatsoever in the fs_game
// start the loop again using the hardcoded BASEDIRNAME
fn = FS_BuildOSPath( pwdpath, BASEGAME, fname );
Com_Printf( "Sys_LoadDll(%s)... ", fn );
libHandle = dlopen( fn, Q_RTLD );
if ( !libHandle ) {
Com_Printf( "failed (%s)\n", dlerror() );
// homepath
fn = FS_BuildOSPath( homepath, BASEGAME, fname );
Com_Printf( "Sys_LoadDll(%s)... ", fn );
libHandle = dlopen( fn, Q_RTLD );
if ( !libHandle ) {
Com_Printf( "failed (%s)\n", dlerror() );
// homepath
fn = FS_BuildOSPath( basepath, BASEGAME, fname );
Com_Printf( "Sys_LoadDll(%s)... ", fn );
libHandle = dlopen( fn, Q_RTLD );
if ( !libHandle ) {
// ok, this time things are really fucked
Com_Printf( "failed (%s)\n", dlerror() );
} else {
Com_Printf( "ok\n" );
}
} else {
Com_Printf( "ok\n" );
}
} else {
Com_Printf( "ok\n" );
}
} // end BASEGAME != fs_game section
} else {
Com_Printf( "ok\n" );
}
} else {
Com_Printf( "ok\n" );
}
} else {
Com_Printf( "ok\n" );
}
if ( !libHandle ) {
#ifndef NDEBUG // in debug, abort on failure
Com_Error( ERR_FATAL, "Sys_LoadDll(%s) failed dlopen() completely!\n", name );
#else
Com_Printf( "Sys_LoadDll(%s) failed dlopen() completely!\n", name );
#endif
return NULL;
}
Com_Printf( "Sys_LoadDll handle = %p", libHandle );
typedef void QDECL DllEntryProc( SystemCallProc *syscallptr );
DllEntryProc *dllEntry = (DllEntryProc *)dlsym( libHandle, "dllEntry" );
void *entryPoint = dlsym( libHandle, "vmMain" );
// dllEntry = dlsym( libHandle, "dllEntry" );
// *entryPoint = dlsym( libHandle, "vmMain" );
if ( !entryPoint || !dllEntry ) {
err = dlerror();
#ifndef NDEBUG // bk001206 - in debug abort on failure
Com_Error( ERR_FATAL, "Sys_LoadDll(%s) failed dlsym(vmMain):\n\"%s\" !\n", name, err );
#else
Com_Printf( "Sys_LoadDll(%s) failed dlsym(vmMain):\n\"%s\" !\n", name, err );
#endif
dlclose( libHandle );
err = dlerror();
if ( err != NULL ) {
Com_Printf( "Sys_LoadDll(%s) failed dlcose:\n\"%s\"\n", name, err );
}
return NULL;
}
Com_Printf( "Sys_LoadDll(%s) found **vmMain** at %p \n", name, entryPoint ); // bk001212
//dllEntry( systemcalls );
Com_Printf( "Sys_LoadDll(%s) succeeded!\n", name );
return libHandle;
}
/*
=================

View file

@ -30,8 +30,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
if (!vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged)
{
float screenXScale = 1.0f / 3.5f;
float screenYScale = 1.0f / 3.5f;
float screenXScale = 1.0f / 2.5f;
float screenYScale = 1.0f / 2.5f;
float xoffset = -24;
if (cg.refdef.stereoView == 1) {

View file

@ -100,7 +100,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define WAVE_AMPLITUDE 1
#define WAVE_FREQUENCY 0.4
#define DEFAULT_PLAYER_HEIGHT 58
#define DEFAULT_PLAYER_HEIGHT 64
//=================================================

View file

@ -382,7 +382,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_fov, "cg_fov", "80", CVAR_ARCHIVE },
{ &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE },
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE },
{ &cg_worldScale, "cg_worldScale", "37.5", CVAR_ARCHIVE },
{ &cg_worldScale, "cg_worldScale", "33.5", CVAR_ARCHIVE },
{ &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE },
{ &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
{ &cg_renderToTextureFX, "cg_renderToTextureFX", "1", CVAR_ARCHIVE },
@ -454,7 +454,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_thirdPersonAlpha, "cg_thirdPersonAlpha", "1.0", CVAR_ARCHIVE },
{ &cg_thirdPersonAutoAlpha, "cg_thirdPersonAutoAlpha", "0", 0 },
// NOTE: also declare this in UI_Init
{ &cg_saberAutoThird, "cg_saberAutoThird", "1", CVAR_ARCHIVE },
{ &cg_saberAutoThird, "cg_saberAutoThird", "0", CVAR_ARCHIVE },
{ &cg_gunAutoFirst, "cg_gunAutoFirst", "1", CVAR_ARCHIVE },
{ &cg_pano, "pano", "0", 0 },

View file

@ -6845,6 +6845,8 @@ void CG_Player( centity_t *cent ) {
return;
}
vr->weaponid = cg.snap->ps.weapon;
calcedMp = qfalse;
//Get the player's light level for stealth calculations

View file

@ -873,7 +873,6 @@ static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origi
//Weapon offset debugging
float scale=1.0f;
if (strcmp(cgi_Cvar_Get("vr_control_scheme"), "99") == 0) {
vr->weaponid = ps->weapon;
scale = vr->test_scale;
//Adjust angles for weapon models that aren't aligned very well

View file

@ -2144,7 +2144,7 @@ void R_WorldEffectCommand(const char *command)
return;
}
CParticleCloud& nCloud = mParticleClouds.push_back();
nCloud.Initialize(1000, "gfx/effects/snowflake1.bmp");
nCloud.Initialize(1000, "gfx/effects/snowflake1.tga");
nCloud.mBlendMode = 1;
nCloud.mRotationChangeNext = 0;
nCloud.mColor = 0.75f;

View file

@ -60,7 +60,7 @@ void GL_Bind( image_t *image ) {
int texnum;
if ( !image ) {
ri.Printf( PRINT_WARNING, "GL_Bind: NULL image\n" );
//ri.Printf( PRINT_WARNING, "GL_Bind: NULL image\n" );
texnum = tr.defaultImage->texnum;
} else {
texnum = image->texnum;

View file

@ -29,8 +29,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
if (!vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged)
{
float screenXScale = 1.0f / 3.5f;
float screenYScale = 1.0f / 3.5f;
float screenXScale = 1.0f / 2.5f;
float screenYScale = 1.0f / 2.5f;
float xoffset = -24;
if (cg.refdef.stereoView == 1) {

View file

@ -369,7 +369,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_fov, "cg_fov", "80", CVAR_ARCHIVE },
{ &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE },
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE },
{ &cg_worldScale, "cg_worldScale", "37.5", CVAR_ARCHIVE },
{ &cg_worldScale, "cg_worldScale", "33.5", CVAR_ARCHIVE },
{ &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE },
{ &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
@ -434,7 +434,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_thirdPersonAlpha, "cg_thirdPersonAlpha", "1.0", CVAR_CHEAT },
{ &cg_thirdPersonAutoAlpha, "cg_thirdPersonAutoAlpha", "0", 0 },
{ &cg_saberAutoThird, "cg_saberAutoThird", "1", CVAR_ARCHIVE },
{ &cg_saberAutoThird, "cg_saberAutoThird", "0", CVAR_ARCHIVE },
{ &cg_gunAutoFirst, "cg_gunAutoFirst", "1", CVAR_ARCHIVE },
{ &cg_pano, "pano", "0", 0 },

View file

@ -3462,7 +3462,7 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
VectorCopy(axis[0], hiltEnt.axis[2]);
cgi_R_AddRefEntityToScene(&hiltEnt);
static int playingSaberSwingSound = 0;
if (vr->swingvelocity > SABER_ACTIVATE_VELOCITY && (cg.time - playingSaberSwingSound) > 750)
if (vr->primaryswingvelocity > SABER_ACTIVATE_VELOCITY && (cg.time - playingSaberSwingSound) > 750)
{
cgi_S_StartSound ( hiltEnt.origin, cent->gent->s.number, CHAN_AUTO, cgi_S_RegisterSound( va( "sound/weapons/saber/saberhup%d.wav", Q_irand( 0, 2 ) * 3 + 1 ) ) );
playingSaberSwingSound = cg.time;
@ -4688,7 +4688,7 @@ Ghoul2 Insert End
if ( cg.time > saberTrail->lastTime + 2 && saberTrail->inAction ) // 2ms
{
//Swinging the saber quick enough to trigger a sound should also invoke trails
if ( (saberTrail->inAction || (vr->swingvelocity > SABER_ACTIVATE_VELOCITY)) &&
if ( (saberTrail->inAction || (vr->primaryswingvelocity > SABER_ACTIVATE_VELOCITY)) &&
cg.time < saberTrail->lastTime + 300 ) // if we have a stale segment, don't draw until we have a fresh one
{
vec3_t rgb1={255,255,255};
@ -4859,6 +4859,8 @@ void CG_Player(centity_t *cent ) {
return;
}
vr->weaponid = cg.snap->ps.weapon;
//Get the player's light level for stealth calculations
CG_GetPlayerLightLevel( cent );

View file

@ -790,7 +790,6 @@ static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origi
//Weapon offset debugging
float scale=1.0f;
if (strcmp(cgi_Cvar_Get("vr_control_scheme"), "99") == 0) {
vr->weaponid = ps->weapon;
scale = vr->test_scale;
//Adjust angles for weapon models that aren't aligned very well

View file

@ -25,7 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define WAYPOINT_NONE -1
#define MAX_STORED_WAYPOINTS 512//???
#define MAX_STORED_WAYPOINTS 2048//??? can I increase this>!?!
#define MAX_WAYPOINT_REACHED_DIST_SQUARED 1024 //32 squared
#define MAX_COLL_AVOID_DIST 128
#define NAVGOAL_USE_RADIUS 16384 //Used to force the waypoint_navgoals with a manually set radius to actually do a DistanceSquared check, not just bounds overlap