mirror of https://github.com/AxioDL/metaforce.git
RumbleFxTable: Use std::array for the lookup table
Strongly enforces the type of the array and also allows size querying, etc, directly from the type.
This commit is contained in:
parent
d7493d5920
commit
9983366a53
|
@ -19,7 +19,7 @@ s16 CRumbleManager::Rumble(CStateManager& mgr, const zeus::CVector3f& pos, ERumb
|
|||
|
||||
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 x0_rumbleGenerator.Rumble(RumbleFxTable[size_t(fx)], gain, priority, EIOPort::Zero);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "RumbleFxTable.hpp"
|
||||
#include "Runtime/Input/RumbleFxTable.hpp"
|
||||
|
||||
namespace urde {
|
||||
|
||||
const SAdsrData RumbleFxTable[] = {
|
||||
const RumbleFXTable RumbleFxTable{{
|
||||
/* attackGain, autoReleaseDur, attackDur, decayDur, sustainGain, releaseDur, hasSustain, autoRelease */
|
||||
{0.48f, 0.f, 0.3f, 0.125f, 0.1f, 0.5f, false, false},
|
||||
{0.66f, 0.f, 0.11f, 0.175f, 0.42f, 0.375f, false, false},
|
||||
|
@ -27,6 +27,7 @@ const SAdsrData RumbleFxTable[] = {
|
|||
{1.2f, 0.f, 0.01f, 0.621f, 0.f, 0.f, false, false},
|
||||
{0.5268f, 0.f, 0.114f, 1.008f, 0.f, 0.325f, false, false},
|
||||
{0.6828f, 0.f, 0.f, 0.821f, 0.f, 0.f, false, false},
|
||||
{1.8f, 0.f, 0.5f, 0.425f, 0.35f, 0.5f, false, false}};
|
||||
{1.8f, 0.f, 0.5f, 0.425f, 0.35f, 0.5f, false, false},
|
||||
}};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "CRumbleVoice.hpp"
|
||||
#include <array>
|
||||
#include "Runtime/Input/CRumbleVoice.hpp"
|
||||
|
||||
namespace urde {
|
||||
|
||||
extern const SAdsrData RumbleFxTable[];
|
||||
using RumbleFXTable = std::array<SAdsrData, 24>;
|
||||
|
||||
extern const RumbleFXTable RumbleFxTable;
|
||||
|
||||
}
|
||||
|
|
|
@ -1429,7 +1429,7 @@ void CFrontEndUI::SOptionsFrontEndFrame::DoMenuSelectionChange(CGuiTableGroup* c
|
|||
|
||||
if (option.option == EGameOption::Rumble && caller->GetUserSelection() > 0) {
|
||||
x40_rumbleGen.HardStopAll();
|
||||
x40_rumbleGen.Rumble(RumbleFxTable[int(ERumbleFxId::PlayerBump)], 1.f, ERumblePriority::One, EIOPort::Zero);
|
||||
x40_rumbleGen.Rumble(RumbleFxTable[size_t(ERumbleFxId::PlayerBump)], 1.f, ERumblePriority::One, EIOPort::Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ void COptionsScreen::OnEnumChanged(CGuiTableGroup* caller, int oldSel) {
|
|||
|
||||
if (opt == EGameOption::Rumble && caller->GetUserSelection() > 0) {
|
||||
x1a8_rumble.HardStopAll();
|
||||
x1a8_rumble.Rumble(RumbleFxTable[int(ERumbleFxId::PlayerBump)], 1.f, ERumblePriority::One, EIOPort::Zero);
|
||||
x1a8_rumble.Rumble(RumbleFxTable[size_t(ERumbleFxId::PlayerBump)], 1.f, ERumblePriority::One, EIOPort::Zero);
|
||||
}
|
||||
|
||||
CPauseScreenBase::UpdateSideTable(caller);
|
||||
|
|
Loading…
Reference in New Issue