2016-02-21 06:34:42 +00:00
|
|
|
#include "CRumbleManager.hpp"
|
2018-01-26 09:48:42 +00:00
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "World/CPlayer.hpp"
|
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "CGameState.hpp"
|
|
|
|
#include "RumbleFxTable.hpp"
|
2016-02-21 06:34:42 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-02-21 06:34:42 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
s16 CRumbleManager::Rumble(CStateManager& mgr, const zeus::CVector3f& pos, ERumbleFxId fx, float dist,
|
|
|
|
ERumblePriority priority) {
|
|
|
|
if (zeus::close_enough(dist, 0.f))
|
2018-01-26 09:48:42 +00:00
|
|
|
return -1;
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CVector3f delta = mgr.GetPlayer().GetTranslation() - pos;
|
|
|
|
if (delta.magSquared() < dist * dist)
|
|
|
|
return Rumble(mgr, fx, 1.f - delta.magnitude() / dist, priority);
|
|
|
|
return -1;
|
2017-04-03 01:39:23 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
s16 CRumbleManager::Rumble(CStateManager& mgr, ERumbleFxId fx, float gain, ERumblePriority priority) {
|
|
|
|
if (g_GameState->GameOptions().GetIsRumbleEnabled())
|
2019-09-10 23:06:26 +00:00
|
|
|
return x0_rumbleGenerator.Rumble(RumbleFxTable[size_t(fx)], gain, priority, EIOPort::Zero);
|
2018-12-08 05:30:43 +00:00
|
|
|
return -1;
|
2018-01-26 09:48:42 +00:00
|
|
|
}
|
2016-02-21 06:34:42 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|