Small Haptic distance fix

& shutdown cleanly on first granting of permissions
This commit is contained in:
Simon 2021-03-31 22:45:14 +01:00
parent d1f570f09a
commit 495f7c3a2f
2 changed files with 4 additions and 20 deletions

View file

@ -1771,7 +1771,7 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo
idAngles directionYaw(0, 180 + (direction.ToYaw() - bodyAng.yaw), 0);
directionYaw.Normalize360();
int intensity = (int)((distance * 100)/ 150.0f);
int intensity = 100 - (int)((distance * 100)/ 150.0f);
Doom3Quest_HapticUpdateEvent(shader->GetName(), intensity, directionYaw.yaw);
} else{
Doom3Quest_HapticUpdateEvent(shader->GetName(), 0, 0);

View file

@ -151,13 +151,6 @@ import static android.system.Os.setenv;
checkPermissionsAndInitialize();
}
private void requestPermissions() {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE},
1);
}
/** Initializes the Activity only if the permission has been granted. */
private void checkPermissionsAndInitialize() {
// Boilerplate for checking runtime permissions in Android.
@ -166,14 +159,10 @@ import static android.system.Os.setenv;
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE},
1);
WRITE_EXTERNAL_STORAGE_PERMISSION_ID);
}
else
{
permissionCount++;
}
if (permissionCount == 1) {
// Permissions have already been granted.
create();
}
@ -183,14 +172,9 @@ import static android.system.Os.setenv;
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] results) {
if (requestCode == WRITE_EXTERNAL_STORAGE_PERMISSION_ID) {
if (results.length > 0 && results[0] != PackageManager.PERMISSION_GRANTED) {
finish();
System.exit(0);
}
finish();
System.exit(0);
}
checkPermissionsAndInitialize();
}
public void create() {