Weapons..

- Start of Baggyg's changes to no-hand vr weapons - now have a scope switchable FG42
- FIx bug where door pushes you and makes yaw go out of sync
- Fix bug where returning knife to backpack causes weapon to fire repeatedly
This commit is contained in:
Simon 2020-07-21 19:11:39 +01:00
parent 04d2ac18ca
commit cda14f7f11
8 changed files with 45 additions and 24 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.rtcwquest"
android:versionCode="16"
android:versionName="0.16.0" android:installLocation="auto" >
android:versionCode="17"
android:versionName="0.17.0" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -9,7 +9,7 @@ enum control_scheme;
#define SCOPE_ENGAGE_DISTANCE 0.25
#define BINOCULAR_ENGAGE_DISTANCE 0.25
#define VELOCITY_TRIGGER 1.8
#define VELOCITY_TRIGGER 1.6
ovrInputStateTrackedRemote leftTrackedRemoteState_old;
ovrInputStateTrackedRemote leftTrackedRemoteState_new;

View file

@ -183,6 +183,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
vr.weaponoffset_timestamp = Sys_Milliseconds( );
//Does weapon velocity trigger attack (knife) and is it fast enough
static qboolean velocityTriggeredAttack = false;
if (vr.velocitytriggered)
{
static qboolean fired = qfalse;
@ -190,13 +191,21 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
powf(pWeapon->HeadPose.LinearVelocity.y, 2) +
powf(pWeapon->HeadPose.LinearVelocity.z, 2));
ALOGV(" Velocity: %f", velocity);
velocityTriggeredAttack = (velocity > VELOCITY_TRIGGER);
if (fired != (velocity > VELOCITY_TRIGGER)) {
sendButtonAction("+attack", (velocity > VELOCITY_TRIGGER));
fired = (velocity > VELOCITY_TRIGGER);
if (fired != velocityTriggeredAttack) {
ALOGV("**WEAPON EVENT** veocity triggered %s", velocityTriggeredAttack ? "+attack" : "-attack");
sendButtonAction("+attack", velocityTriggeredAttack);
fired = velocityTriggeredAttack;
}
}
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 || vr.dualwield)
{

View file

@ -678,8 +678,9 @@ void CG_PredictPlayerState( void ) {
vec3_t adjusted;
CG_AdjustPositionForMover( cg.predictedPlayerState.origin,
cg.predictedPlayerState.groundEntityNum, cg.physicsTime, cg.oldTime, adjusted, deltaAngles );
// RF, add the deltaAngles (fixes jittery view while riding trains)
cg.predictedPlayerState.delta_angles[YAW] += ANGLE2SHORT( deltaAngles[YAW] );
//cg.predictedPlayerState.delta_angles[YAW] += ANGLE2SHORT(deltaAngles[YAW]);
if ( cg_showmiss.integer ) {
if ( !VectorCompare( oldPlayerState.origin, adjusted ) ) {

View file

@ -224,6 +224,7 @@ void Matrix4x4_ConvertToEntity( vec4_t *in, vec3_t angles, vec3_t origin )
int binocularModel;
int fg42NoScopeModel;
int wolfkickModel;
int hWeaponSnd;
int hflakWeaponSnd;
@ -1685,6 +1686,7 @@ void CG_RegisterItemVisuals( int itemNum ) {
itemInfo->registered = qtrue; //----(SA) moved this down after the registerweapon()
binocularModel = trap_R_RegisterModel( "models/powerups/keys/binoculars.md3" );
fg42NoScopeModel = trap_R_RegisterModel( "models/weapons2/fg42/v_fg42_noscope.mdc" );
wolfkickModel = trap_R_RegisterModel( "models/weapons2/foot/v_wolfoot_10f.md3" );
hWeaponSnd = trap_S_RegisterSound( "sound/weapons/mg42/37mm.wav" );
@ -2947,7 +2949,14 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
return;
}
else {
gun.hModel = weapon->weaponModel[W_FP_MODEL];
if (weaponNum == WP_FG42 && cgVR->scopedetached)
{
//Use the no-scope model
gun.hModel = fg42NoScopeModel;
}
else {
gun.hModel = weapon->weaponModel[W_FP_MODEL];
}
}
} else {
CG_AddProtoWeapons( parent, ps, cent );
@ -3505,16 +3514,16 @@ void CG_AddViewWeapon( playerState_t *ps ) {
cgVR->velocitytriggered = qtrue;
cgVR->scopedweapon = qfalse;
break;
case WP_FG42:
case WP_MAUSER:
cgVR->velocitytriggered = qfalse;
cgVR->scopedweapon = qtrue;
cgVR->detachablescope = qtrue;
break;
case WP_SNIPERRIFLE:
case WP_GARAND:
case WP_SNOOPERSCOPE:
case WP_FG42:
case WP_FG42SCOPE:
case WP_SNIPERRIFLE:
case WP_FG42SCOPE:
cgVR->velocitytriggered = qfalse;
cgVR->scopedweapon = qtrue;
cgVR->scopedetached = qfalse;
@ -4386,13 +4395,14 @@ void CG_WeaponDetachScope_f( void ) {
original = cg.weaponSelect;
//Can only detach the scope from the mauser
if (original != WP_MAUSER)
//Can only detach the scope from the Mauser / FG42
if (original != WP_MAUSER &&
original != WP_FG42 )
{
return;
}
CG_PlaySwitchSound( WP_MAUSER, WP_MAUSER );
CG_PlaySwitchSound( original, original );
cgVR->scopedetached = !cgVR->scopedetached;
}

View file

@ -287,12 +287,13 @@ qboolean G_TryPushingEntity( gentity_t *check, gentity_t *pusher, vec3_t move
// try moving the contacted entity
VectorAdd( check->s.pos.trBase, move, check->s.pos.trBase );
if ( check->client ) {
// make sure the client's view rotates when on a rotating mover
// RF, this is done client-side now
check->client->ps.delta_angles[YAW] += ANGLE2SHORT( amove[YAW] );
//
// RF, AI's need their ideal angle adjusted instead
//Only change yaw for AI characters in VR
if ( check->aiCharacter ) {
// make sure the client's view rotates when on a rotating mover
// RF, this is done client-side now
check->client->ps.delta_angles[YAW] += ANGLE2SHORT( amove[YAW] );
//
// RF, AI's need their ideal angle adjusted instead
AICast_AdjustIdealYawForMover( check->s.number, ANGLE2SHORT( amove[YAW] ) );
}
}

View file

@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
// q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file
#define Q3_VERSION "RTCWQuest 0.16.0 (Wolf 1.41)"
#define Q3_VERSION "RTCWQuest 0.17.0 (Wolf 1.41)"
// ver 1.0.0 - release
// ver 1.0.1 - post-release work
// ver 1.1.0 - patch 1 (12/12/01)

View file

@ -171,10 +171,10 @@ import static android.system.Os.setenv;
copy_asset("/sdcard/RTCWQuest/Main", "weapons_hd.cfg");
//and the demo version
copy_asset("/sdcard/RTCWQuest/Main", "pak0.pk3");
//copy_asset("/sdcard/RTCWQuest/Main", "pak0.pk3");
//and the weapons
copy_asset("/sdcard/RTCWQuest/Main", "sp_pak_weapons.pk3");
//and the vr weapons
copy_asset("/sdcard/RTCWQuest/Main", "vr_sp_pak_weapons.pk3");
//Read these from a file and pass through
commandLineParams = new String("rtcw");