Small tweaks to the melee

This commit is contained in:
Simon 2023-05-22 21:28:54 +01:00
parent dfa54a439a
commit beb5a6d7c6
7 changed files with 13 additions and 11 deletions

View file

@ -956,6 +956,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//process force motion controls here //process force motion controls here
if (vr_force_motion_controlled->integer && if (vr_force_motion_controlled->integer &&
cl.frame.ps.weapon != WP_MELEE &&
!vr.weapon_stabilised && !vr.weapon_stabilised &&
// If dual sabers we can't really use motion control force as the off hand could be swinging for an attack // If dual sabers we can't really use motion control force as the off hand could be swinging for an attack
!vr.dualsabers) !vr.dualsabers)

View file

@ -1405,7 +1405,8 @@ void FireWeapon( gentity_t *ent, qboolean alt_fire )
} }
else else
{ {
WP_Melee( ent ); //Pass true so we know this is actually melee from a tusken rifle
WP_Melee( ent, qtrue );
} }
break; break;
@ -1465,7 +1466,7 @@ void FireWeapon( gentity_t *ent, qboolean alt_fire )
alert = 0; // if you want it to alert enemies, remove this alert = 0; // if you want it to alert enemies, remove this
if ( !alt_fire || !g_debugMelee->integer ) if ( !alt_fire || !g_debugMelee->integer )
{ {
WP_Melee( ent ); WP_Melee( ent, qfalse );
} }
break; break;

View file

@ -67,7 +67,7 @@ void WP_EmplacedFire( gentity_t *ent );
void prox_mine_think( gentity_t *ent ); void prox_mine_think( gentity_t *ent );
void prox_mine_stick( gentity_t *self, gentity_t *other, trace_t *trace ); void prox_mine_stick( gentity_t *self, gentity_t *other, trace_t *trace );
void WP_FireFlechette( gentity_t *ent, qboolean alt_fire ); void WP_FireFlechette( gentity_t *ent, qboolean alt_fire );
void WP_Melee( gentity_t *ent ); void WP_Melee( gentity_t *ent, qboolean alt_fire );
void WP_FireNoghriStick( gentity_t *ent ); void WP_FireNoghriStick( gentity_t *ent );
void WP_FireRepeater( gentity_t *ent, qboolean alt_fire ); void WP_FireRepeater( gentity_t *ent, qboolean alt_fire );
void rocketThink( gentity_t *ent ); void rocketThink( gentity_t *ent );

View file

@ -26,13 +26,13 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
void WP_Melee( gentity_t *ent ) void WP_Melee( gentity_t *ent, qboolean alt_fire )
//--------------------------------------------------------- //---------------------------------------------------------
{ {
gentity_t *tr_ent; gentity_t *tr_ent;
trace_t tr; trace_t tr;
vec3_t mins, maxs, end; vec3_t mins, maxs, end;
int damage = ent->s.number ? (g_spskill->integer*2)+1 : 25; int damage = ent->s.number ? (g_spskill->integer*2)+1 : (alt_fire ? 3 : 20);
float range = ent->s.number ? 64 : 32; float range = ent->s.number ? 64 : 32;
VectorMA( muzzle, range, forwardVec, end ); VectorMA( muzzle, range, forwardVec, end );
@ -67,7 +67,7 @@ void WP_Melee( gentity_t *ent )
if ( tr_ent && tr_ent->takedamage ) if ( tr_ent && tr_ent->takedamage )
{ {
int dflags = DAMAGE_NO_KNOCKBACK; int dflags = (ent->s.number || alt_fire) ? DAMAGE_NO_KNOCKBACK : DAMAGE_DEATH_KNOCKBACK;
G_PlayEffect( G_EffectIndex( "melee/punch_impact" ), tr.endpos, forwardVec ); G_PlayEffect( G_EffectIndex( "melee/punch_impact" ), tr.endpos, forwardVec );
//G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) ); //G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) );
if ( ent->NPC && (ent->NPC->aiFlags&NPCAI_HEAVY_MELEE) ) if ( ent->NPC && (ent->NPC->aiFlags&NPCAI_HEAVY_MELEE) )

View file

@ -636,7 +636,7 @@ void FireWeapon( gentity_t *ent, qboolean alt_fire )
case WP_MELEE: case WP_MELEE:
alert = 0; // if you want it to alert enemies, remove this alert = 0; // if you want it to alert enemies, remove this
WP_Melee( ent ); WP_Melee( ent, qfalse );
break; break;
case WP_ATST_MAIN: case WP_ATST_MAIN:

View file

@ -61,7 +61,7 @@ void WP_EmplacedFire( gentity_t *ent );
void WP_FireFlechette( gentity_t *ent, qboolean alt_fire ); void WP_FireFlechette( gentity_t *ent, qboolean alt_fire );
void prox_mine_stick( gentity_t *self, gentity_t *other, trace_t *trace ); void prox_mine_stick( gentity_t *self, gentity_t *other, trace_t *trace );
void prox_mine_think( gentity_t *ent ); void prox_mine_think( gentity_t *ent );
void WP_Melee( gentity_t *ent ); void WP_Melee( gentity_t *ent, qboolean alt_fire );
void WP_FireRepeater( gentity_t *ent, qboolean alt_fire ); void WP_FireRepeater( gentity_t *ent, qboolean alt_fire );
void rocketThink( gentity_t *ent ); void rocketThink( gentity_t *ent );
void WP_FireRocket( gentity_t *ent, qboolean alt_fire ); void WP_FireRocket( gentity_t *ent, qboolean alt_fire );

View file

@ -30,13 +30,13 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
// Temp melee attack damage routine // Temp melee attack damage routine
//--------------------------------------------------------- //---------------------------------------------------------
void WP_Melee( gentity_t *ent ) void WP_Melee( gentity_t *ent, qboolean alt_fire )
//--------------------------------------------------------- //---------------------------------------------------------
{ {
gentity_t *tr_ent; gentity_t *tr_ent;
trace_t tr; trace_t tr;
vec3_t mins, maxs, end; vec3_t mins, maxs, end;
int damage = ent->s.number ? (g_spskill->integer*2)+1 : 25; int damage = ent->s.number ? (g_spskill->integer*2)+1 : 20;
float range = ent->s.number ? 64 : 32; float range = ent->s.number ? 64 : 32;
VectorMA( wpMuzzle, range, wpFwd, end ); VectorMA( wpMuzzle, range, wpFwd, end );
@ -68,6 +68,6 @@ void WP_Melee( gentity_t *ent )
if ( tr_ent && tr_ent->takedamage ) if ( tr_ent && tr_ent->takedamage )
{ {
G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) ); G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) );
G_Damage( tr_ent, ent, ent, wpFwd, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, MOD_MELEE ); G_Damage( tr_ent, ent, ent, wpFwd, tr.endpos, damage, DAMAGE_DEATH_KNOCKBACK, MOD_MELEE );
} }
} }