Haptics hopefully finished + Cybershoes

Also changed doors to always soft open
This commit is contained in:
Grant Bagwell 2021-07-16 00:54:51 +02:00
parent b0d53d4bcd
commit 600475e91c
10 changed files with 96 additions and 38 deletions

View file

@ -928,12 +928,13 @@ void RTCWVR_Haptic( int duration, int channel, float intensity, char *descriptio
else if(strcmp(description,"end_alarm") == 0) {
RTCWVR_HapticStopEvent("heartbeat");
}
else if(strcmp(description,"give_armor") == 0) {
RTCWVR_HapticEvent(description, 0, 0, 100.0f * intensity, yaw, height);
}
else if(strcmp(description,"give_health") == 0) {
RTCWVR_HapticEvent(description, 0, 0, 100.0f * intensity, yaw, height);
else if(strcmp(description,"switch_weapon") == 0 || strcmp(description,"pickup_item") == 0) {
RTCWVR_HapticEvent(description, channel == 1 ? 2 : 1, 0, 100.0f * intensity, 0, 0);
}
else if(strcmp(description,"give_armor") == 0 || strcmp(description,"give_food") == 0 ||
strcmp(description,"give_drink") == 0 || strcmp(description,"give_health") == 0 || strcmp(description,"pickup_treasure") == 0) {
RTCWVR_HapticEvent(description, 0, 0, 100.0f * intensity, yaw, height);
}
else if(strstr(description,"damage_") != NULL) {
RTCWVR_HapticEvent(description, 0, 0, 100.0f * intensity, yaw, height);
}
@ -1651,7 +1652,7 @@ void * AppThreadFunction(void * parm ) {
// This app will handle android gamepad events itself.
vrapi_SetPropertyInt(&gAppState.Java, VRAPI_EAT_NATIVE_GAMEPAD_EVENTS, 0);
//Set device defaults
//Set device defaults
if (vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DEVICE_TYPE) == VRAPI_DEVICE_TYPE_OCULUSQUEST)
{
if (SS_MULTIPLIER == 0.0f)
@ -1664,6 +1665,7 @@ void * AppThreadFunction(void * parm ) {
if (SS_MULTIPLIER == 0.0f)
{
//Lower to allow 90hz to work nicely
//GB Override as refresh is now 72 by default
SS_MULTIPLIER = 1.0f;
}
else if (SS_MULTIPLIER > 1.2F)
@ -1733,7 +1735,7 @@ void * AppThreadFunction(void * parm ) {
if (REFRESH == 0 || REFRESH > maximumSupportRefresh)
{
REFRESH = maximumSupportRefresh;
REFRESH = 72.0;
}
//-----------------------------------------------------------------------------------------------------------
@ -1864,12 +1866,14 @@ void RTCWVR_getTrackedRemotesOrientation() {//Get info for tracked remotes
switch (vr_control_scheme->integer)
{
case RIGHT_HANDED_DEFAULT:
HandleInput_Default(&rightTrackedRemoteState_new, &rightTrackedRemoteState_old, &rightRemoteTracking_new,
HandleInput_Default(&footTrackedRemoteState_new, &footTrackedRemoteState_old,
&rightTrackedRemoteState_new, &rightTrackedRemoteState_old, &rightRemoteTracking_new,
&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, &leftRemoteTracking_new,
ovrButton_A, ovrButton_B, ovrButton_X, ovrButton_Y);
break;
case LEFT_HANDED_DEFAULT:
HandleInput_Default(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, &leftRemoteTracking_new,
HandleInput_Default(&footTrackedRemoteState_new, &footTrackedRemoteState_old,
&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, &leftRemoteTracking_new,
&rightTrackedRemoteState_new, &rightTrackedRemoteState_old, &rightRemoteTracking_new,
ovrButton_X, ovrButton_Y, ovrButton_A, ovrButton_B);
break;

View file

@ -21,6 +21,9 @@ ovrInputStateTrackedRemote rightTrackedRemoteState_old;
ovrInputStateTrackedRemote rightTrackedRemoteState_new;
ovrTracking rightRemoteTracking_new;
ovrInputStateGamepad footTrackedRemoteState_old;
ovrInputStateGamepad footTrackedRemoteState_new;
ovrDeviceID controllerIDs[2];
float remote_movementSideways;
@ -35,7 +38,8 @@ void sendButtonActionSimple(const char* action);
void acquireTrackedRemotesData(const ovrMobile *Ovr, double displayTime);
void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateGamepad *pFootTrackingOld,
ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTracking* pOffTracking,
int domButton1, int domButton2, int offButton1, int offButton2 );

View file

@ -94,7 +94,22 @@ void acquireTrackedRemotesData(const ovrMobile *Ovr, double displayTime) {//The
break;
}
if (cap.Type == ovrControllerType_TrackedRemote) {
if (cap.Type == ovrControllerType_Gamepad) {
ovrInputGamepadCapabilities remoteCaps;
remoteCaps.Header = cap;
if (vrapi_GetInputDeviceCapabilities(Ovr, &remoteCaps.Header) >= 0) {
// remote is connected
ovrInputStateGamepad remoteState;
remoteState.Header.ControllerType = ovrControllerType_Gamepad;
if ( vrapi_GetCurrentInputState( Ovr, cap.DeviceID, &remoteState.Header ) >= 0 )
{
// act on device state returned in remoteState
footTrackedRemoteState_new = remoteState;
}
}
}
else if (cap.Type == ovrControllerType_TrackedRemote) {
ovrTracking remoteTracking;
ovrInputStateTrackedRemote trackedRemoteState;
trackedRemoteState.Header.ControllerType = ovrControllerType_TrackedRemote;

View file

@ -27,7 +27,8 @@ void SV_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const ve
void RTCWVR_HapticEvent(const char* event, int position, int flags, int intensity, float angle, float yHeight );
void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateGamepad *pFootTrackingOld,
ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTracking* pOffTracking,
int domButton1, int domButton2, int offButton1, int offButton2 )
@ -444,6 +445,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
//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 qboolean firing = false;
@ -549,8 +552,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Apply a filter and quadratic scaler so small movements are easier to make
float dist = length(pSecondaryJoystick->x, pSecondaryJoystick->y);
float nlf = nonLinearFilter(dist);
float x = nlf * pSecondaryJoystick->x;
float y = nlf * pSecondaryJoystick->y;
float x = (nlf * pSecondaryJoystick->x) + pFootTrackingNew->LeftJoystick.x;
float y = (nlf * pSecondaryJoystick->y) - pFootTrackingNew->LeftJoystick.y;
vr.player_moving = (fabs(x) + fabs(y)) > 0.05f;
@ -616,6 +619,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
handleTrackedControllerButton(pOffTrackedRemoteNew,
pOffTrackedRemoteOld,
ovrButton_Trigger, K_SHIFT);
} else {
if (pOffTrackedRemoteNew->Buttons & ovrButton_Trigger)
{

View file

@ -32,9 +32,10 @@ If you have questions concerning this license or the applicable additional terms
#include "cg_local.h"
#include "../ui/ui_shared.h" // for Menus_CloseAll()
#include "../../../RTCWVR/VrClientInfo.h"
extern int hWeaponSnd;
extern vr_client_info_t *cgVR;
extern void CG_Tracer( vec3_t source, vec3_t dest, int sparks );
//==========================================================================
@ -1979,17 +1980,17 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
// client will get this message if reloading while using an alternate weapon
// client should voluntarily switch back to primary at that point
switch ( es->weapon ) {
case WP_SNOOPERSCOPE:
newweap = WP_GARAND;
break;
case WP_SNIPERRIFLE:
newweap = WP_MAUSER;
break;
case WP_FG42SCOPE:
newweap = WP_FG42;
break;
default:
break;
case WP_SNOOPERSCOPE:
newweap = WP_GARAND;
break;
case WP_SNIPERRIFLE:
newweap = WP_MAUSER;
break;
case WP_FG42SCOPE:
newweap = WP_FG42;
break;
default:
break;
}
// TTimo

View file

@ -4359,6 +4359,7 @@ void CG_SetSniperZoom( int lastweap, int newweap ) {
default:
Com_Printf("**WEAPON EVENT** cgVR->scopeengaged = qfalse");
cgVR->scopeengaged = qfalse;
trap_Haptic(1, cgVR->right_handed ? 1 : 0, 0.7f, "switch_weapon", 0.0f, 0.0f);
break;
}
@ -4372,6 +4373,7 @@ void CG_SetSniperZoom( int lastweap, int newweap ) {
switch ( newweap ) {
default:
return; // no sniper zoom, get out.
case WP_SNIPERRIFLE:

View file

@ -102,7 +102,7 @@ void P_DamageFeedback( gentity_t *player ) {
Com_Printf( "GBRTCW: damage location pitch = %f", pitch );
if(pitch > -90)
pitch = pitch / 180.0;
else if(pitch < -270 && pitch > -360)
else if(pitch <= -270 && pitch > -360)
pitch = (pitch + 360) / 180;
VectorCopy( client->ps.viewangles, viewangle );
//If this doesn't work try (+ 360) instead of abs
@ -119,7 +119,7 @@ void P_DamageFeedback( gentity_t *player ) {
//AnglesToAxis( viewangle, wolfkick.axis );
switch(client->lasthurt_mod)
{
case MOD_SHOTGUN:
case MOD_SHOTGUN:
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_shotgun", yaw, pitch);
break;
case MOD_GRENADE:
@ -186,6 +186,7 @@ void P_DamageFeedback( gentity_t *player ) {
case MOD_AIRSTRIKE:
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_explosion", yaw, pitch);
break;
case MOD_GAUNTLET:
case MOD_GRAPPLE:
case MOD_KICKED:
case MOD_GRABBER:
@ -221,7 +222,7 @@ void P_DamageFeedback( gentity_t *player ) {
break;
default:
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage", yaw, pitch);
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_mid_bullet", yaw, pitch);
break;
}
trap_Vibrate(1000, 0, (count / 255.0) + 0.5f, "ignore", 0.0, 0.0);

View file

@ -1407,7 +1407,8 @@ void Cmd_Activate_f( gentity_t *ent ) {
if ( ( ( Q_stricmp( traceEnt->classname, "func_door" ) == 0 ) || ( Q_stricmp( traceEnt->classname, "func_door_rotating" ) == 0 ) ) ) {
//----(SA) modified
if ( walking ) {
//GB Force this on as they don't hve a key which seems unfair in VR
if ( walking || 1 == 1) {
traceEnt->flags |= FL_SOFTACTIVATE; // no noise
}
G_TryDoor( traceEnt, ent, ent ); // (door,other,activator)
@ -1419,7 +1420,7 @@ void Cmd_Activate_f( gentity_t *ent ) {
// Use_BinaryMover (traceEnt, ent, ent);
// traceEnt->active = qtrue;
} else if ( !Q_stricmp( traceEnt->classname, "func_invisible_user" ) ) {
if ( walking ) {
if ( walking || 1 == 1) {
traceEnt->flags |= FL_SOFTACTIVATE; // no noise
}
traceEnt->use( traceEnt, ent, ent );

View file

@ -39,7 +39,7 @@ If you have questions concerning this license or the applicable additional terms
*/
#include "g_local.h"
#include "../../../RTCWVR/VrClientInfo.h"
#define RESPAWN_SP -1
@ -54,7 +54,7 @@ If you have questions concerning this license or the applicable additional terms
#define RESPAWN_PARTIAL 998 // for multi-stage ammo/health
#define RESPAWN_PARTIAL_DONE 999 // for multi-stage ammo/health
extern vr_client_info_t* gVR;
//======================================================================
int Pickup_Powerup( gentity_t *ent, gentity_t *other ) {
@ -87,6 +87,7 @@ int Pickup_Powerup( gentity_t *ent, gentity_t *other ) {
// brandy also gives a little health (10)
if ( ent->item->giTag == PW_NOFATIGUE ) {
if ( Q_stricmp( ent->item->classname, "item_stamina_brandy" ) == 0 ) {
trap_Haptic(1, 0, 0.6, "give_drink", 0.0f, 0.0f);
other->health += 10;
if ( other->health > other->client->ps.stats[STAT_MAX_HEALTH] ) {
other->health = other->client->ps.stats[STAT_MAX_HEALTH];
@ -169,6 +170,7 @@ int Pickup_Powerup( gentity_t *ent, gentity_t *other ) {
//======================================================================
int Pickup_Key( gentity_t *ent, gentity_t *other ) {
other->client->ps.stats[STAT_KEYS] |= ( 1 << ent->item->giTag );
trap_Haptic(1, gVR->right_handed ? 1 : 0, 1.0f, "pickup_item", 0.0f, 0.0f);
if ( g_gametype.integer == GT_SINGLE_PLAYER ) {
if ( !( ent->spawnflags & 8 ) ) {
return RESPAWN_SP;
@ -187,6 +189,7 @@ Pickup_Clipboard
*/
int Pickup_Clipboard( gentity_t *ent, gentity_t *other ) {
trap_Haptic(1, gVR->right_handed ? 1 : 0, 1.0f, "pickup_item", 0.0f, 0.0f);
if ( ent->spawnflags & 4 ) {
return 0; // leave in world
@ -203,6 +206,7 @@ Pickup_Treasure
int Pickup_Treasure( gentity_t *ent, gentity_t *other ) {
gentity_t *player = AICast_FindEntityForName( "player" );
player->numTreasureFound++;
trap_Haptic(1, 0, 1.0, "pickup_treasure", 0.0f, 0.0f);
G_SendMissionStats();
return RESPAWN_SP; // no respawn
}
@ -218,6 +222,7 @@ void UseHoldableItem( gentity_t *ent, int item ) {
switch ( item ) {
case HI_WINE: // 1921 Chateu Lafite - gives 25 pts health up to max health
ent->health += 25;
trap_Haptic(1, 0, 1.0, "give_drink", 0.0f, 0.0f);
if ( ent->health > ent->client->ps.stats[STAT_MAX_HEALTH] ) {
ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
}
@ -256,6 +261,7 @@ int Pickup_Holdable( gentity_t *ent, gentity_t *other ) {
other->client->ps.holding = item->giTag;
other->client->ps.stats[STAT_HOLDABLE_ITEM] |= ( 1 << ent->item->giTag ); //----(SA) added
trap_Haptic(1, gVR->right_handed ? 1 : 0, 1.0f, "pickup_item", 0.0f, 0.0f);
if ( g_gametype.integer == GT_SINGLE_PLAYER ) {
if ( !( ent->spawnflags & 8 ) ) {
@ -386,6 +392,7 @@ int Pickup_Ammo( gentity_t *ent, gentity_t *other ) {
}
Add_Ammo( other, ent->item->giTag, quantity, qfalse ); //----(SA) modified
trap_Haptic(1, gVR->right_handed ? 1 : 0, 1.0f, "pickup_item", 0.0f, 0.0f);
// single player has no respawns (SA)
if ( g_gametype.integer == GT_SINGLE_PLAYER ) {
@ -468,6 +475,7 @@ int Pickup_Weapon( gentity_t *ent, gentity_t *other ) {
//----(SA) end
Add_Ammo( other, weapon, quantity, !alreadyHave );
trap_Haptic(1, gVR->right_handed ? 1 : 0, 1.0f, "pickup_item", 0.0f, 0.0f);
//----(SA) no hook
// if (weapon == WP_GRAPPLING_HOOK)
@ -503,7 +511,23 @@ int Pickup_Health( gentity_t *ent, gentity_t *other ) {
intensity = ent->count / 100;
if(intensity < 0.4)
intensity = 0.4f;
trap_Haptic(1,0,intensity,"give_health",0.0f, 0.0f);
//Need to find food and see if different (cheese and other stuff)
//item_health / icons/iconh_med (25)
//item_health_wall / icons/iconh_wall (25)
//item_health_turkey / icons/iconh_turkey (15)
//item_health_breadandmeat / "icons/iconh_breadandmeat (10)
if(strstr(ent->item->classname,"turkey") ||
strstr(ent->item->classname,"bread") ||
strstr(ent->item->classname,"meat") ||
strstr(ent->item->classname,"wine") ||
strstr(ent->item->classname,"latour")) {
//quantity (25)
trap_Haptic(1, 0, intensity, "give_food", 0.0f, 0.0f);
} else {
trap_Haptic(1, 0, intensity, "give_health", 0.0f, 0.0f);
}
// small and mega healths will go over the max
if ( ent->item->quantity != 5 && ent->item->quantity != 100 ) {

View file

@ -1393,7 +1393,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
if ( kicked ) {
ent->teammaster->flags |= FL_KICKACTIVATE;
}
if ( soft ) {
else if ( soft || 1 == 1) {
ent->teammaster->flags |= FL_SOFTACTIVATE;
}
@ -2210,11 +2210,13 @@ void G_TryDoor( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
else
{
ent->active = qtrue;
if ( walking ) {
if ( walking || 1 == 1) {
ent->flags |= FL_SOFTACTIVATE; // no noise
trap_Vibrate(1, gVR->right_handed ? 0 : 1, 1.0f, "door_open", 0, 0); //I've reversed the hands as I presume you will open it with the hand your gun isn't in.
if(gVR)
trap_Vibrate(1, gVR->right_handed ? 0 : 1, 0.3f, "door_open", 0, 0); //I've reversed the hands as I presume you will open it with the hand your gun isn't in.
} else {
trap_Vibrate(1, gVR->right_handed ? 0 : 1, 0.6f, "door_open", 0, 0); //I've reversed the hands as I presume you will open it with the hand your gun isn't in.
if(gVR)
trap_Vibrate(1, gVR->right_handed ? 0 : 1, 0.5f, "door_open", 0, 0); //I've reversed the hands as I presume you will open it with the hand your gun isn't in.
if ( activator ) {
soundrange = HEAR_RANGE_DOOR_OPEN;
}