mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 23:07:42 +00:00
Implement rumble classes
This commit is contained in:
@@ -1,15 +1,29 @@
|
||||
#include "CRumbleManager.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "World/CPlayer.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CGameState.hpp"
|
||||
#include "RumbleFxTable.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
void CRumbleManager::SetDisabled(bool disabled)
|
||||
s16 CRumbleManager::Rumble(CStateManager& mgr, const zeus::CVector3f& pos,
|
||||
ERumbleFxId fx, float dist, ERumblePriority priority)
|
||||
{
|
||||
if (disabled)
|
||||
x0_rumbleGenerator.HardStopAll();
|
||||
xf0_24_disabled = disabled;
|
||||
if (zeus::close_enough(dist, 0.f))
|
||||
return -1;
|
||||
zeus::CVector3f delta = mgr.GetPlayer().GetTranslation() - pos;
|
||||
if (delta.magSquared() < dist * dist)
|
||||
return Rumble(mgr, fx, 1.f - delta.magnitude() / dist, priority);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CRumbleManager::Update(float dt) { x0_rumbleGenerator.Update(dt); }
|
||||
s16 CRumbleManager::Rumble(CStateManager& mgr, ERumbleFxId fx, float gain, ERumblePriority priority)
|
||||
{
|
||||
if (g_GameState->GameOptions().GetIsRumbleEnabled())
|
||||
return x0_rumbleGenerator.Rumble(RumbleFxTable[int(fx)], gain, priority, EIOPort::Zero);
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user