Add game-configurable shake/swing commands for the nunchuk at three intensities
This commit is contained in:
parent
fb7a6a1bbe
commit
9936a83a1b
|
@ -17,4 +17,14 @@ namespace Config
|
||||||
const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_HARD{ { System::WiiPad, "Shake", "Hard" }, 5.0 };
|
const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_HARD{ { System::WiiPad, "Shake", "Hard" }, 5.0 };
|
||||||
const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_MEDIUM{ { System::WiiPad, "Shake", "Medium" }, 3.0 };
|
const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_MEDIUM{ { System::WiiPad, "Shake", "Medium" }, 3.0 };
|
||||||
const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_SOFT{ { System::WiiPad, "Shake", "Soft" }, 2.0 };
|
const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_SOFT{ { System::WiiPad, "Shake", "Soft" }, 2.0 };
|
||||||
|
|
||||||
|
// NunchuckInput.Settings
|
||||||
|
|
||||||
|
const ConfigInfo<double> NUNCHUK_INPUT_SWING_INTENSITY_FAST{ { System::WiiPad, "Nunchuk_Swing", "Fast" }, 4.5 };
|
||||||
|
const ConfigInfo<double> NUNCHUK_INPUT_SWING_INTENSITY_MEDIUM{ { System::WiiPad, "Nunchuk_Swing", "Medium" }, 2.5 };
|
||||||
|
const ConfigInfo<double> NUNCHUK_INPUT_SWING_INTENSITY_SLOW{ { System::WiiPad, "Nunchuk_Swing", "Slow" }, 1.5 };
|
||||||
|
|
||||||
|
const ConfigInfo<double> NUNCHUK_INPUT_SHAKE_INTENSITY_HARD{ { System::WiiPad, "Nunchuk_Shake", "Hard" }, 5.0 };
|
||||||
|
const ConfigInfo<double> NUNCHUK_INPUT_SHAKE_INTENSITY_MEDIUM{ { System::WiiPad, "Nunchuk_Shake", "Medium" }, 3.0 };
|
||||||
|
const ConfigInfo<double> NUNCHUK_INPUT_SHAKE_INTENSITY_SOFT{ { System::WiiPad, "Nunchuk_Shake", "Soft" }, 2.0 };
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,4 +20,14 @@ namespace Config
|
||||||
extern const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_MEDIUM;
|
extern const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_MEDIUM;
|
||||||
extern const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_SOFT;
|
extern const ConfigInfo<double> WIIMOTE_INPUT_SHAKE_INTENSITY_SOFT;
|
||||||
|
|
||||||
|
// NunchuckInput.Settings
|
||||||
|
|
||||||
|
extern const ConfigInfo<double> NUNCHUK_INPUT_SWING_INTENSITY_FAST;
|
||||||
|
extern const ConfigInfo<double> NUNCHUK_INPUT_SWING_INTENSITY_MEDIUM;
|
||||||
|
extern const ConfigInfo<double> NUNCHUK_INPUT_SWING_INTENSITY_SLOW;
|
||||||
|
|
||||||
|
extern const ConfigInfo<double> NUNCHUK_INPUT_SHAKE_INTENSITY_HARD;
|
||||||
|
extern const ConfigInfo<double> NUNCHUK_INPUT_SHAKE_INTENSITY_MEDIUM;
|
||||||
|
extern const ConfigInfo<double> NUNCHUK_INPUT_SHAKE_INTENSITY_SOFT;
|
||||||
|
|
||||||
} // namespace Config
|
} // namespace Config
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Common/Common.h"
|
#include "Common/Common.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/MathUtil.h"
|
#include "Common/MathUtil.h"
|
||||||
|
#include "Core/Config/WiimoteInputSettings.h"
|
||||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||||
|
|
||||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||||
|
@ -42,6 +43,8 @@ Nunchuk::Nunchuk(ExtensionReg& reg) : Attachment(_trans("Nunchuk"), reg)
|
||||||
|
|
||||||
// swing
|
// swing
|
||||||
groups.emplace_back(m_swing = new ControllerEmu::Force(_trans("Swing")));
|
groups.emplace_back(m_swing = new ControllerEmu::Force(_trans("Swing")));
|
||||||
|
groups.emplace_back(m_swing_slow = new ControllerEmu::Force("SwingSlow"));
|
||||||
|
groups.emplace_back(m_swing_fast = new ControllerEmu::Force("SwingFast"));
|
||||||
|
|
||||||
// tilt
|
// tilt
|
||||||
groups.emplace_back(m_tilt = new ControllerEmu::Tilt(_trans("Tilt")));
|
groups.emplace_back(m_tilt = new ControllerEmu::Tilt(_trans("Tilt")));
|
||||||
|
@ -55,6 +58,16 @@ Nunchuk::Nunchuk(ExtensionReg& reg) : Attachment(_trans("Nunchuk"), reg)
|
||||||
// i18n: Refers to a 3D axis (used when mapping motion controls)
|
// i18n: Refers to a 3D axis (used when mapping motion controls)
|
||||||
m_shake->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::Translate, _trans("Z")));
|
m_shake->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::Translate, _trans("Z")));
|
||||||
|
|
||||||
|
groups.emplace_back(m_shake_soft = new ControllerEmu::Buttons("ShakeSoft"));
|
||||||
|
m_shake_soft->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, "X"));
|
||||||
|
m_shake_soft->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, "Y"));
|
||||||
|
m_shake_soft->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, "Z"));
|
||||||
|
|
||||||
|
groups.emplace_back(m_shake_hard = new ControllerEmu::Buttons("ShakeHard"));
|
||||||
|
m_shake_hard->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, "X"));
|
||||||
|
m_shake_hard->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, "Y"));
|
||||||
|
m_shake_hard->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, "Z"));
|
||||||
|
|
||||||
m_id = nunchuk_id;
|
m_id = nunchuk_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,9 +104,15 @@ void Nunchuk::GetState(u8* const data)
|
||||||
EmulateTilt(&accel, m_tilt);
|
EmulateTilt(&accel, m_tilt);
|
||||||
|
|
||||||
// swing
|
// swing
|
||||||
EmulateSwing(&accel, m_swing, 2.5);
|
EmulateSwing(&accel, m_swing, Config::Get(Config::NUNCHUK_INPUT_SWING_INTENSITY_MEDIUM));
|
||||||
|
EmulateSwing(&accel, m_swing_slow, Config::Get(Config::NUNCHUK_INPUT_SWING_INTENSITY_SLOW));
|
||||||
|
EmulateSwing(&accel, m_swing_fast, Config::Get(Config::NUNCHUK_INPUT_SWING_INTENSITY_FAST));
|
||||||
|
|
||||||
// shake
|
// shake
|
||||||
EmulateShake(&accel, m_shake, 3.0, m_shake_step.data());
|
EmulateShake(&accel, m_shake, Config::Get(Config::NUNCHUK_INPUT_SHAKE_INTENSITY_MEDIUM), m_shake_step.data());
|
||||||
|
EmulateShake(&accel, m_shake_soft, Config::Get(Config::NUNCHUK_INPUT_SHAKE_INTENSITY_SOFT), m_shake_soft_step.data());
|
||||||
|
EmulateShake(&accel, m_shake_hard, Config::Get(Config::NUNCHUK_INPUT_SHAKE_INTENSITY_HARD), m_shake_hard_step.data());
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
m_buttons->GetState(&nc_data.bt.hex, nunchuk_button_bitmasks.data());
|
m_buttons->GetState(&nc_data.bt.hex, nunchuk_button_bitmasks.data());
|
||||||
|
|
||||||
|
|
|
@ -55,12 +55,18 @@ public:
|
||||||
private:
|
private:
|
||||||
ControllerEmu::Tilt* m_tilt;
|
ControllerEmu::Tilt* m_tilt;
|
||||||
ControllerEmu::Force* m_swing;
|
ControllerEmu::Force* m_swing;
|
||||||
|
ControllerEmu::Force* m_swing_slow;
|
||||||
|
ControllerEmu::Force* m_swing_fast;
|
||||||
|
|
||||||
ControllerEmu::Buttons* m_shake;
|
ControllerEmu::Buttons* m_shake;
|
||||||
|
ControllerEmu::Buttons* m_shake_soft;
|
||||||
|
ControllerEmu::Buttons* m_shake_hard;
|
||||||
|
|
||||||
ControllerEmu::Buttons* m_buttons;
|
ControllerEmu::Buttons* m_buttons;
|
||||||
ControllerEmu::AnalogStick* m_stick;
|
ControllerEmu::AnalogStick* m_stick;
|
||||||
|
|
||||||
std::array<u8, 3> m_shake_step{};
|
std::array<u8, 3> m_shake_step{};
|
||||||
|
std::array<u8, 3> m_shake_soft_step{};
|
||||||
|
std::array<u8, 3> m_shake_hard_step{};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue