Don't trigger haptics when blade hits solid if saber is in flight

This commit is contained in:
Simon 2023-07-12 16:33:15 +01:00
parent 19be309f9a
commit b4596caab9
2 changed files with 24 additions and 12 deletions

View file

@ -6504,10 +6504,13 @@ Ghoul2 Insert End
{ {
if ( !noMarks ) if ( !noMarks )
{ {
int position = (vr->right_handed ? if (saberNum == 1 || !cent->gent->client->ps.saberInFlight)
((saberNum == 0) ? 2 : 1) : {
((saberNum == 0) ? 1 : 2)); int position = (vr->right_handed ?
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); ((saberNum == 0) ? 2 : 1) :
((saberNum == 0) ? 1 : 2));
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0);
}
/* /*
if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) ) if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) )
@ -6534,10 +6537,13 @@ Ghoul2 Insert End
{ {
if ( !noMarks ) if ( !noMarks )
{ {
int position = (vr->right_handed ? if (saberNum == 1 || !cent->gent->client->ps.saberInFlight)
((saberNum == 0) ? 2 : 1) : {
((saberNum == 0) ? 1 : 2)); int position = (vr->right_handed ?
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); ((saberNum == 0) ? 2 : 1) :
((saberNum == 0) ? 1 : 2));
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0);
}
if ( ( !WP_SaberBladeUseSecondBladeStyle( &client->ps.saber[saberNum], bladeNum ) && !(client->ps.saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS) ) if ( ( !WP_SaberBladeUseSecondBladeStyle( &client->ps.saber[saberNum], bladeNum ) && !(client->ps.saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS) )
|| ( WP_SaberBladeUseSecondBladeStyle( &client->ps.saber[saberNum], bladeNum ) && !(client->ps.saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS2) ) ) || ( WP_SaberBladeUseSecondBladeStyle( &client->ps.saber[saberNum], bladeNum ) && !(client->ps.saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS2) ) )

View file

@ -4588,8 +4588,11 @@ Ghoul2 Insert End
{ {
if ( (trace.contents&CONTENTS_WATER) || (trace.contents&CONTENTS_SLIME) ) if ( (trace.contents&CONTENTS_WATER) || (trace.contents&CONTENTS_SLIME) )
{ {
int position = (vr->right_handed ? 2 : 1); if (!cent->gent->client->ps.saberInFlight)
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); {
int position = (vr->right_handed ? 2 : 1);
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0);
}
/* /*
if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) ) if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) )
@ -4610,8 +4613,11 @@ Ghoul2 Insert End
} }
else else
{ {
int position = (vr->right_handed ? 2 : 1); if (!cent->gent->client->ps.saberInFlight)
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); {
int position = (vr->right_handed ? 2 : 1);
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0);
}
theFxScheduler.PlayEffect( "spark", trace.endpos, trace.plane.normal ); theFxScheduler.PlayEffect( "spark", trace.endpos, trace.plane.normal );
// All I need is a bool to mark whether I have a previous point to work with. // All I need is a bool to mark whether I have a previous point to work with.