mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2024-11-23 12:22:20 +00:00
Small Haptic distance fix
& shutdown cleanly on first granting of permissions
This commit is contained in:
parent
d1f570f09a
commit
495f7c3a2f
2 changed files with 4 additions and 20 deletions
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue