mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
gitadora: various fixes for wailing (#513)
## Link to GitHub Issue, if one exists Fixes #512 ## Description of change Fix digital wailing not being recognized consistently. Also address the fact that wailing was completely broken when lefty mode was on. This requires a new option that the user needs to check off in the configurator since we can't magically guess if the user is holding the guitar in lefty mode. - [x] fix downward wail - [x] digital lefty mode - [x] implement all of this for arena model i/o - [x] test dx cab 2p - [x] lefty toggle in overlay - [x] fix analog not working for 2p guitar - [ ] analog lefty mode? ## Testing Checked GW and GW Delta
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
|
||||
#include "misc/eamuse.h"
|
||||
#include "util/utils.h"
|
||||
#include "games/gitadora/gitadora.h"
|
||||
#include "util/socd_cleaner.h"
|
||||
#include "util/time.h"
|
||||
#include "util/utils.h"
|
||||
#include "io.h"
|
||||
#include "j33i.h"
|
||||
|
||||
|
||||
#define GUITAR_BTN_R 0x7
|
||||
#define GUITAR_BTN_G 0x6
|
||||
#define GUITAR_BTN_B 0x5
|
||||
@@ -111,8 +112,8 @@ bool games::gitadora::J33ISerialDevice::parse_msg(
|
||||
|
||||
auto &analogs = get_analogs();
|
||||
|
||||
// get x,y,z analog values [-0.5f, 0.5f], centered at 0.f
|
||||
float x = 0.f;
|
||||
// get x,y,z analog values [-0.5f, 0.5f]
|
||||
float x = is_player_lefty(0) ? 0.3f : -0.5f;
|
||||
auto x_analog = analogs[Analogs::GuitarP1WailX];
|
||||
if (x_analog.isSet()) {
|
||||
x = GameAPI::Analogs::getState(RI_MGR, x_analog) - 0.5f;
|
||||
@@ -123,11 +124,6 @@ bool games::gitadora::J33ISerialDevice::parse_msg(
|
||||
if (y_analog.isSet()) {
|
||||
y = GameAPI::Analogs::getState(RI_MGR, y_analog) - 0.5f;
|
||||
}
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::GuitarP1WailUp])) {
|
||||
y = -0.5f;
|
||||
} else if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::GuitarP1WailDown])) {
|
||||
y = 0.5f;
|
||||
}
|
||||
|
||||
float z = 0.f;
|
||||
auto z_analog = analogs[Analogs::GuitarP1WailZ];
|
||||
@@ -135,6 +131,31 @@ bool games::gitadora::J33ISerialDevice::parse_msg(
|
||||
z = GameAPI::Analogs::getState(RI_MGR, z_analog) - 0.5f;
|
||||
}
|
||||
|
||||
// handle digital wail up/down
|
||||
const auto wail_up = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::GuitarP1WailUp]);
|
||||
const auto wail_down = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::GuitarP1WailDown]);
|
||||
const auto wail_result =
|
||||
socd::get_guitar_wail(0, wail_up, wail_down, get_performance_milliseconds());
|
||||
if (!is_player_lefty(0)) {
|
||||
// righty
|
||||
if (wail_result == socd::TiltUp) {
|
||||
x = 0;
|
||||
y = -0.5f;
|
||||
} else if (wail_result == socd::TiltDown) {
|
||||
x = -0.5f;
|
||||
y = 0.5f;
|
||||
}
|
||||
} else {
|
||||
// lefty
|
||||
if (wail_result == socd::TiltUp) {
|
||||
x = 0.f;
|
||||
y = 0.f;
|
||||
} else if (wail_result == socd::TiltDown) {
|
||||
x = 0.5f;
|
||||
y = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
// convert x,y,z to unsigned integer values that the game expects
|
||||
const uint16_t x_int = x * ARENA_MODEL_WAIL_MAX * 2;
|
||||
const uint16_t y_int = y * ARENA_MODEL_WAIL_MAX * 2;
|
||||
|
||||
Reference in New Issue
Block a user