When releasing flashlight back to backpack, it will restore previous weapon
This commit is contained in:
Simon 2020-09-16 00:18:38 +01:00
parent ec594e1357
commit 9778a2c6cc
2 changed files with 13 additions and 6 deletions

View file

@ -332,9 +332,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
{
if (pVRClientInfo->backpackitemactive == 1) {
//Restores last used weapon if possible
char buffer[32];
sprintf(buffer, "weapon %i", pVRClientInfo->lastweaponid);
sendButtonActionSimple(buffer);
if (pVRClientInfo->weaponid != -1) {
Android_SetImpuse(UB_IMPULSE0 + pVRClientInfo->weaponid);
}
pVRClientInfo->backpackitemactive = 0;
}
else if ((GetTimeInMilliSeconds() - dominantGripPushTime) < vr_reloadtimeoutms) {
@ -346,9 +346,10 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
if (!dominantButton1Pushed && pVRClientInfo->backpackitemactive == 2)
{
char buffer[32];
sprintf(buffer, "weapon %i", pVRClientInfo->lastweaponid);
sendButtonActionSimple(buffer);
//Restores last used weapon if possible
if (pVRClientInfo->weaponid != -1) {
Android_SetImpuse(UB_IMPULSE0 + pVRClientInfo->weaponid);
}
pVRClientInfo->backpackitemactive = 0;
}
@ -356,6 +357,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
{
pVRClientInfo->backpackitemactive = 0;
}
} else {
if (pVRClientInfo->backpackitemactive == 0) {
if (dominantGripPushed) {

View file

@ -6418,6 +6418,11 @@ void idPlayer::Think( void ) {
playerView.CalculateShake();
}
if (pVRClientInfo != nullptr)
{
pVRClientInfo->weaponid = currentWeapon;
}
if ( !( thinkFlags & TH_THINK ) ) {
gameLocal.Printf( "player %d not thinking?\n", entityNumber );
}