2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-13 13:51:21 +00:00
metaforce/Runtime/Input/CRumbleManager.cpp
Lioncash 221cc5c6b8 RuntimeCommonB: Normalize cpp file includes
Like the prior changes normalizing the inclusions within headers, this
tackles the cpp files of the RuntimeCommonB target, making these source
files consistent with their headers.
2019-12-22 18:12:04 -05:00

28 lines
948 B
C++

#include "Runtime/Input/CRumbleManager.hpp"
#include "Runtime/CGameState.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Input/RumbleFxTable.hpp"
#include "Runtime/World/CPlayer.hpp"
namespace urde {
s16 CRumbleManager::Rumble(CStateManager& mgr, const zeus::CVector3f& pos, ERumbleFxId fx, float dist,
ERumblePriority priority) {
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;
}
s16 CRumbleManager::Rumble(CStateManager& mgr, ERumbleFxId fx, float gain, ERumblePriority priority) {
if (g_GameState->GameOptions().GetIsRumbleEnabled())
return x0_rumbleGenerator.Rumble(RumbleFxTable[size_t(fx)], gain, priority, EIOPort::Zero);
return -1;
}
} // namespace urde