Support for ForeceTube/ProTube Stock

Also added f2hunter to the credits
This commit is contained in:
Simon 2022-05-15 10:33:49 +01:00
parent 8cf2ffc445
commit b659a9e09e
6 changed files with 72 additions and 37 deletions

Binary file not shown.

View file

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.ioq3quest"
android:installLocation="preferExternal"
android:versionCode="52"
android:versionName="1.0.0">
android:versionCode="53"
android:versionName="1.1.0">
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
<uses-feature android:glEsVersion="0x00030001" />
<!-- <uses-feature android:name="oculus.software.overlay_keyboard" android:required="false"/>-->

View file

@ -1318,6 +1318,10 @@ static void CG_LightningBolt( centity_t *cent, vec3_t origin ) {
vec3_t angle;
CG_CalculateVRWeaponPosition(muzzlePoint, angle);
AngleVectors(angle, forward, NULL, NULL );
//Handle this here so it is refreshed on every frame, not just when the lightning gun is first fired
int position = vr->weapon_stabilised ? 4 : (vr->right_handed ? 1 : 2);
trap_HapticEvent("RTCWQuest:fire_tesla", position, 0, 100, 0, 0);
} else {
// !CPMA
AngleVectors( cent->lerpAngles, forward, NULL, NULL );
@ -2529,7 +2533,7 @@ void CG_FireWeapon( centity_t *cent ) {
trap_HapticEvent("rocket_fire", position, 0, 100, 0, 0);
break;
case WP_LIGHTNING:
trap_HapticEvent("RTCWQuest:fire_tesla", position, 0, 100, 0, 0);
//Haptics handled in the CG_LightningBolt code
break;
case WP_RAILGUN:
trap_HapticEvent("RTCWQuest:fire_sniper", position, 0, 100, 0, 0);
@ -2543,7 +2547,7 @@ void CG_FireWeapon( centity_t *cent ) {
trap_HapticEvent("bfg_fire", position, 0, 100, 0, 0);
break;
case WP_GRAPPLING_HOOK:
trap_HapticEvent("chainsaw_fire", position, 0, 100, 0, 0);
//No Haptics
break;
#ifdef MISSIONPACK
case WP_NAILGUN:

View file

@ -145,11 +145,11 @@ Special Thanks to the whole discord!
y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawProportionalString( 320, y, "Dedicated Beta Testers", UI_CENTER|UI_SMALLFONT, color_red );
y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawString( 320, y, "XQuader, Ceno, Cukier, Bummser, Retro1N, Benny91, April, Ikarus,", UI_CENTER|UI_SMALLFONT, color_white );
UI_DrawString( 320, y, "f2hunter, XQuader, Ceno, Cukier, Bummser, Retro1N, Benny91, Ikarus,", UI_CENTER|UI_SMALLFONT, color_white );
y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawString( 320, y, "Bim, Lubos, MasakaPete, Config2, Maniac, Ghostdog72, Slydog43,", UI_CENTER|UI_SMALLFONT, color_white );
y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawString( 320, y, "Cornelius, Ferret, RealityForge, PvtGenO, SatanSlayer", UI_CENTER|UI_SMALLFONT, color_white );
UI_DrawString( 320, y, "April, Cornelius, Ferret, RealityForge, PvtGenO, SatanSlayer", UI_CENTER|UI_SMALLFONT, color_white );
y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawProportionalString( 320, y, "Special Thanks to the whole Team Beef discord!", UI_CENTER|UI_SMALLFONT, color_red );

View file

@ -1,16 +1,19 @@
package com.drbeef.ioq3quest;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.util.Pair;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.drbeef.externalhapticsservice.HapticServiceClient;
import com.drbeef.externalhapticsservice.HapticsConstants;
import org.libsdl.app.SDLActivity;
@ -24,6 +27,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Vector;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@ -40,7 +44,11 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback
String commandLineParams;
private HapticServiceClient externalHapticsServiceClient = null;
private Vector<HapticServiceClient> externalHapticsServiceClients = new Vector<>();
//Use a vector of pairs, it is possible a given package _could_ in the future support more than one haptic service
//so a map here of Package -> Action would not work.
private static Vector<Pair<String, String>> externalHapticsServiceDetails = new Vector<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -53,6 +61,16 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback
}
@Override protected void onDestroy()
{
Log.i(TAG, "onDestroy called");
for (HapticServiceClient externalHapticsServiceClient : externalHapticsServiceClients) {
externalHapticsServiceClient.stopBinding();
}
super.onDestroy();
}
/**
* Initializes the Activity only if the permission has been granted.
@ -143,11 +161,15 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback
} catch (Exception e) {
}
externalHapticsServiceClient = new HapticServiceClient(this, (state, desc) -> {
Log.v(TAG, "ExternalHapticsService is:" + desc);
});
for (Pair<String, String> serviceDetail : externalHapticsServiceDetails) {
HapticServiceClient client = new HapticServiceClient(this, (state, desc) -> {
Log.v(TAG, "ExternalHapticsService " + serviceDetail.second + ": " + desc);
}, new Intent(serviceDetail.second)
.setPackage(serviceDetail.first));
externalHapticsServiceClient.bindService();
client.bindService();
externalHapticsServiceClients.add(client);
}
Log.d(TAG, "nativeCreate");
nativeCreate(this);
@ -204,39 +226,48 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback
static {
System.loadLibrary("main");
//Add possible external haptic service details here
externalHapticsServiceDetails.add(Pair.create(HapticsConstants.BHAPTICS_PACKAGE, HapticsConstants.BHAPTICS_ACTION_FILTER));
externalHapticsServiceDetails.add(Pair.create(HapticsConstants.FORCETUBE_PACKAGE, HapticsConstants.FORCETUBE_ACTION_FILTER));
}
public void haptic_event(String event, int position, int flags, int intensity, float angle, float yHeight) {
if (externalHapticsServiceClient.hasService()) {
try {
if (!hapticsEnabled)
{
externalHapticsServiceClient.getHapticsService().hapticEnable();
hapticsEnabled = true;
return;
}
boolean areHapticsEnabled = hapticsEnabled;
for (HapticServiceClient externalHapticsServiceClient : externalHapticsServiceClients) {
if (event.compareTo("frame_tick") == 0)
{
externalHapticsServiceClient.getHapticsService().hapticFrameTick();
}
if (externalHapticsServiceClient.hasService()) {
try {
//Enabled all haptics services if required
if (!areHapticsEnabled)
{
externalHapticsServiceClient.getHapticsService().hapticEnable();
hapticsEnabled = true;
continue;
}
//Use the Doom3Quest haptic patterns for now
String app = "Doom3Quest";
if (event.contains(":"))
{
String[] items = event.split(":");
app = items[0];
event = items[1];
if (event.compareTo("frame_tick") == 0)
{
externalHapticsServiceClient.getHapticsService().hapticFrameTick();
}
//Uses the Doom3Quest and RTCWQuest haptic patterns
String app = "Doom3Quest";
String eventID = event;
if (event.contains(":"))
{
String[] items = event.split(":");
app = items[0];
eventID = items[1];
}
externalHapticsServiceClient.getHapticsService().hapticEvent(app, eventID, position, flags, intensity, angle, yHeight);
}
catch (RemoteException r)
{
Log.v(TAG, r.toString());
}
externalHapticsServiceClient.getHapticsService().hapticEvent(app, event, position, flags, intensity, angle, yHeight);
}
catch (RemoteException r)
{
Log.v(TAG, r.toString());
}
}
}
}

View file

@ -3,7 +3,7 @@
setlocal
set BUILD_TYPE=release
set VERSION=1.0.0-rc1
set VERSION=1.1.0
@REM Define the following environment variables to sign a release build
@REM set KEYSTORE=