Skip to content

Commit

Permalink
Add ProtubeVR integration
Browse files Browse the repository at this point in the history
  • Loading branch information
fholger committed Nov 17, 2023
1 parent a1dc7c3 commit bc91916
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Sources/CryGame C++/Solution1/CryGame/CryGame.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;..\..\..\ThirdParty\protubevr;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;_USRDLL;CRYGAME_EXPORTS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
Expand All @@ -136,9 +136,9 @@
</ClCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;Shlwapi.lib;wininet.lib;Wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;protubevr.lib;Shlwapi.lib;wininet.lib;Wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;..\BinkSDK;..\CryNetwork\Debug;.\..\ubisoft.com\GSServices\sdks/gs-sdk-regserver/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-msclient/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-common/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-base/lib_win32;..\ubisoft.com\GSServices\sdks\gs-sdk-cdkey\lib_win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;..\..\..\ThirdParty\protubevr;..\BinkSDK;..\CryNetwork\Debug;.\..\ubisoft.com\GSServices\sdks/gs-sdk-regserver/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-msclient/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-common/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-base/lib_win32;..\ubisoft.com\GSServices\sdks\gs-sdk-cdkey\lib_win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
Expand Down Expand Up @@ -167,7 +167,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;..\..\..\ThirdParty\protubevr;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_RELEASE;NDEBUG;USE_GAME_DLL;WIN32;_WINDOWS;_USRDLL;CRYGAME_EXPORTS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
Expand All @@ -190,10 +190,10 @@
</ClCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;Shlwapi.lib;wininet.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;protubevr.lib;Shlwapi.lib;wininet.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>.\Release/CryGame.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;..\BinkSDK;..\CryNetwork\Release;.\..\ubisoft.com\GSServices\sdks/gs-sdk-regserver/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-msclient/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-common/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-base/lib_win32;..\ubisoft.com\GSServices\sdks\gs-sdk-cdkey\lib_win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;..\..\..\ThirdParty\protubevr;..\BinkSDK;..\CryNetwork\Release;.\..\ubisoft.com\GSServices\sdks/gs-sdk-regserver/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-msclient/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-common/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-base/lib_win32;..\ubisoft.com\GSServices\sdks\gs-sdk-cdkey\lib_win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>.\Release/CryGame.pdb</ProgramDatabaseFile>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
Expand Down Expand Up @@ -221,7 +221,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;..\..\..\ThirdParty\protubevr;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;USE_GAME_DLL;WIN32;_WINDOWS;_USRDLL;CRYGAME_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
Expand All @@ -243,9 +243,9 @@
</ClCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 /OPT:ref,icf %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;Shlwapi.lib;wininet.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;protubevr.lib;Shlwapi.lib;wininet.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;..\BinkSDK;..\CryNetwork\Release;.\..\ubisoft.com\GSServices\sdks/gs-sdk-regserver/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-msclient/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-result/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-cdkey/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-common/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-base/lib_win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;..\..\..\ThirdParty\protubevr;..\BinkSDK;..\CryNetwork\Release;.\..\ubisoft.com\GSServices\sdks/gs-sdk-regserver/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-msclient/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-result/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-cdkey/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-common/lib_win32;.\..\ubisoft.com\GSServices\sdks/gs-sdk-base/lib_win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
Expand All @@ -270,7 +270,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug64|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;..\..\..\ThirdParty\protubevr;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_AMD64_;_DEBUG;WIN64;WIN32;_WINDOWS;_USRDLL;CRYGAME_EXPORTS;DIVX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand All @@ -290,15 +290,15 @@
</ClCompile>
<Link>
<AdditionalOptions>/MACHINE:AMD64 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;Shlwapi.lib;wininet.lib;Ws2_32.lib;../CryCommon/fSinCos64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;protubevr.lib;Shlwapi.lib;wininet.lib;Ws2_32.lib;../CryCommon/fSinCos64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<LargeAddressAware>true</LargeAddressAware>
<ImportLibrary>$(OutDir)$(ProjectName).lib</ImportLibrary>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;..\..\..\ThirdParty\protubevr;</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<Midl>
Expand All @@ -323,7 +323,7 @@
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\STLPORT\stlport;..\CryCommon;..\..\..\ThirdParty\dxvk\src\d3d9;..\..\..\ThirdParty\dxvk\include\vulkan\include;..\..\..\ThirdParty\minhook\include;..\..\..\ThirdParty\openvr\headers;..\..\..\ThirdParty\ffmpeg\include;..\..\..\ThirdParty\bhaptics\include\shared;..\..\..\ThirdParty\protubevr;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_RELEASE;NDEBUG;WIN64;WIN32;_AMD64_;_WINDOWS;_USRDLL;CRYGAME_EXPORTS;DIVX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
Expand All @@ -341,15 +341,15 @@
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;Shlwapi.lib;wininet.lib;Ws2_32.lib;../CryCommon/fSinCos64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>d3d9.lib;dsound.lib;openvr_api.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;swresample.lib;haptic_library.lib;protubevr.lib;Shlwapi.lib;wininet.lib;Ws2_32.lib;../CryCommon/fSinCos64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<LargeAddressAware>true</LargeAddressAware>
<ImportLibrary>$(OutDir)$(ProjectName).lib</ImportLibrary>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\ThirdParty\dxvk\lib;..\..\..\ThirdParty\openvr\lib\win32;..\..\..\ThirdParty\bhaptics\bin\win32;..\..\..\ThirdParty\ffmpeg\lib;..\..\..\ThirdParty\protubevr;</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<Midl>
Expand Down
15 changes: 15 additions & 0 deletions Sources/CryGame C++/Solution1/CryGame/ScriptObjectPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ void CScriptObjectPlayer::InitializeTemplate(IScriptSystem *pSS)
REG_FUNC(CScriptObjectPlayer, TriggerBHapticsEffect);
REG_FUNC(CScriptObjectPlayer, IsBHapticsEffectPlaying);
REG_FUNC(CScriptObjectPlayer, StopBHapticsEffect);
REG_FUNC(CScriptObjectPlayer, TriggerProtubeEffect);

pSS->SetGlobalValue("BITMASK_PLAYER",BITMASK_PLAYER);
pSS->SetGlobalValue("BITMASK_WEAPON",BITMASK_WEAPON);
Expand Down Expand Up @@ -2208,6 +2209,20 @@ int CScriptObjectPlayer::StopBHapticsEffect(IFunctionHandler* pH)
return pH->EndFunction();
}

int CScriptObjectPlayer::TriggerProtubeEffect(IFunctionHandler* pH)
{
CHECK_PARAMETERS(3);
float kickPower = 0;
float rumblePower = 0;
float rumbleSeconds = 0;
pH->GetParam(1, kickPower);
pH->GetParam(2, rumblePower);
pH->GetParam(3, rumbleSeconds);

m_pPlayer->TriggerProtubeEffect(kickPower, rumblePower, rumbleSeconds);
return pH->EndFunction();
}

//////////////////////////////////////////////////////////////////////
IEntityRender * CScriptObjectPlayer::GetIEntityRender(const pe_params_foreign_data & fd)
{
Expand Down
1 change: 1 addition & 0 deletions Sources/CryGame C++/Solution1/CryGame/ScriptObjectPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public IScriptObjectSink
int TriggerBHapticsEffect(IFunctionHandler* pH);
int IsBHapticsEffectPlaying(IFunctionHandler* pH);
int StopBHapticsEffect(IFunctionHandler* pH);
int TriggerProtubeEffect(IFunctionHandler* pH);

private:

Expand Down
24 changes: 24 additions & 0 deletions Sources/CryGame C++/Solution1/CryGame/VRHaptics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "VRInput.h"
#include "VRManager.h"
#include <HapticLibrary.h>
#include <protubevr.h>



Expand All @@ -13,6 +14,7 @@ void VRHaptics::Init(CXGame* game, VRInput* vrInput)
m_vrInput = vrInput;
CryLogAlways("Initialised haptics.");
InitialiseSync("farcryvr", "Far Cry VR");
InitRifle();
InitEffects();
}

Expand Down Expand Up @@ -119,6 +121,28 @@ void VRHaptics::StopAllEffects()
TurnOff();
}

void VRHaptics::ProtubeKick(float power, bool twoHanded)
{
uint8 pw = clamp_tpl(power, 0.f, 1.f) * 255;
ForceTubeVRChannel channel = twoHanded ? rifle : rifleButt;
KickChannel(pw, channel);
}

void VRHaptics::ProtubeRumble(float power, float seconds, bool twoHanded)
{
uint8 pw = clamp_tpl(power, 0.f, 1.f) * 255;
ForceTubeVRChannel channel = twoHanded ? rifle : rifleButt;
RumbleChannel(pw, seconds, channel);
}

void VRHaptics::ProtubeShot(float kickPower, float rumblePower, float rumbleSeconds, bool twoHanded)
{
uint8 kpw = clamp_tpl(kickPower, 0.f, 1.f) * 255;
uint8 rpw = clamp_tpl(rumblePower, 0.f, 1.f) * 255;
ForceTubeVRChannel channel = twoHanded ? rifle : rifleButt;
ShotChannel(kpw, rpw, rumbleSeconds, channel);
}

void VRHaptics::CreateFlatEffect(const char* effectName, float duration, float amplitude, float easeInTime, float easeOutTime)
{
HapticEffect& effect = m_effects[effectName];
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryGame C++/Solution1/CryGame/VRHaptics.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class VRHaptics
void StopEffects(int hand);
void StopAllEffects();

void ProtubeKick(float power, bool twoHanded);
void ProtubeRumble(float power, float seconds, bool twoHanded);
void ProtubeShot(float kickPower, float rumblePower, float rumbleSeconds, bool twoHanded);

void CreateFlatEffect(const char* effectName, float duration, float amplitude, float easeInTime = 0.0f, float easeOutTime = 0.0f);
void CreateCustomEffect(const char* effectName, float* amplitudes, int count);

Expand Down
18 changes: 18 additions & 0 deletions Sources/CryGame C++/Solution1/CryGame/XPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2786,6 +2786,24 @@ void CPlayer::TriggerBHapticsEffect(const char* keyRight, const char* keyLeft, f
TriggerBHapticsEffect(keyRight, keyLeft, intensity, delta, offsetY);
}

void CPlayer::TriggerProtubeEffect(float kickPower, float rumblePower, float rumbleSeconds)
{
if (IsMyPlayer())
{
if (kickPower > 0)
{
if (rumblePower > 0 && rumbleSeconds > 0)
gVR->GetHaptics()->ProtubeShot(kickPower, rumblePower, rumbleSeconds, m_twoHandWeaponMode);
else
gVR->GetHaptics()->ProtubeKick(kickPower, m_twoHandWeaponMode);
}
else if (rumblePower > 0 && rumbleSeconds > 0)
{
gVR->GetHaptics()->ProtubeRumble(rumblePower, rumbleSeconds, m_twoHandWeaponMode);
}
}
}

void CPlayer::ModifyVehicleWeaponAim(Vec3& aimPos, Vec3& aimAngles)
{
if (!m_usesMotionControls)
Expand Down
1 change: 1 addition & 0 deletions Sources/CryGame C++/Solution1/CryGame/XPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ enum eInVehiclestate
void TriggerWeaponHapticEffect(const char* effectName, float amplitudeModifier = 1.0f);
void TriggerBHapticsEffect(const char* keyRight, const char* keyLeft, float intensity = 1.0f, float offsetAngleX = 0, float offsetY = 0);
void TriggerBHapticsEffect(const char* keyRight, const char* keyLeft, float intensity, const Vec3& pos, const Vec3& dir);
void TriggerProtubeEffect(float kickPower, float rumblePower, float rumbleSeconds);

void ModifyVehicleWeaponAim(Vec3& aimPos, Vec3& aimAngles);
void UpdateMountedGunAnglesFromController();
Expand Down
Binary file not shown.
Loading

0 comments on commit bc91916

Please sign in to comment.