mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-04-28 04:55:41 -04:00
NamcoGuncon: Add button to shoot offscreen
This commit is contained in:
parent
7ca0d357cb
commit
fad3d79895
@ -60,6 +60,13 @@ void NamcoGunCon::SetAxisState(s32 axis_code, float value) {}
|
|||||||
|
|
||||||
void NamcoGunCon::SetButtonState(Button button, bool pressed)
|
void NamcoGunCon::SetButtonState(Button button, bool pressed)
|
||||||
{
|
{
|
||||||
|
if (button == Button::ShootOffscreen)
|
||||||
|
{
|
||||||
|
m_shoot_offscreen = pressed;
|
||||||
|
SetButtonState(Button::Trigger, pressed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr std::array<u8, static_cast<size_t>(Button::Count)> indices = {{13, 3, 14}};
|
static constexpr std::array<u8, static_cast<size_t>(Button::Count)> indices = {{13, 3, 14}};
|
||||||
if (pressed)
|
if (pressed)
|
||||||
m_button_state &= ~(u16(1) << indices[static_cast<u8>(button)]);
|
m_button_state &= ~(u16(1) << indices[static_cast<u8>(button)]);
|
||||||
@ -169,7 +176,8 @@ void NamcoGunCon::UpdatePosition()
|
|||||||
|
|
||||||
// are we within the active display area?
|
// are we within the active display area?
|
||||||
u32 tick, line;
|
u32 tick, line;
|
||||||
if (mouse_x < 0 || mouse_y < 0 || !g_gpu->ConvertScreenCoordinatesToBeamTicksAndLines(mouse_x, mouse_y, &tick, &line))
|
if (mouse_x < 0 || mouse_y < 0 ||
|
||||||
|
!g_gpu->ConvertScreenCoordinatesToBeamTicksAndLines(mouse_x, mouse_y, &tick, &line) || m_shoot_offscreen)
|
||||||
{
|
{
|
||||||
Log_DebugPrintf("Lightgun out of range for window coordinates %d,%d", mouse_x, mouse_y);
|
Log_DebugPrintf("Lightgun out of range for window coordinates %d,%d", mouse_x, mouse_y);
|
||||||
m_position_x = 0x01;
|
m_position_x = 0x01;
|
||||||
@ -204,6 +212,7 @@ std::optional<s32> NamcoGunCon::StaticGetButtonCodeByName(std::string_view butto
|
|||||||
}
|
}
|
||||||
|
|
||||||
BUTTON(Trigger);
|
BUTTON(Trigger);
|
||||||
|
BUTTON(ShootOffscreen);
|
||||||
BUTTON(A);
|
BUTTON(A);
|
||||||
BUTTON(B);
|
BUTTON(B);
|
||||||
|
|
||||||
@ -220,6 +229,7 @@ Controller::AxisList NamcoGunCon::StaticGetAxisNames()
|
|||||||
Controller::ButtonList NamcoGunCon::StaticGetButtonNames()
|
Controller::ButtonList NamcoGunCon::StaticGetButtonNames()
|
||||||
{
|
{
|
||||||
return {{TRANSLATABLE("NamcoGunCon", "Trigger"), static_cast<s32>(Button::Trigger)},
|
return {{TRANSLATABLE("NamcoGunCon", "Trigger"), static_cast<s32>(Button::Trigger)},
|
||||||
|
{TRANSLATABLE("NamcoGunCon", "ShootOffscreen"), static_cast<s32>(Button::ShootOffscreen)},
|
||||||
{TRANSLATABLE("NamcoGunCon", "A"), static_cast<s32>(Button::A)},
|
{TRANSLATABLE("NamcoGunCon", "A"), static_cast<s32>(Button::A)},
|
||||||
{TRANSLATABLE("NamcoGunCon", "B"), static_cast<s32>(Button::B)}};
|
{TRANSLATABLE("NamcoGunCon", "B"), static_cast<s32>(Button::B)}};
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ public:
|
|||||||
Trigger = 0,
|
Trigger = 0,
|
||||||
A = 1,
|
A = 1,
|
||||||
B = 2,
|
B = 2,
|
||||||
|
ShootOffscreen = 3,
|
||||||
Count
|
Count
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -66,6 +67,7 @@ private:
|
|||||||
u16 m_button_state = UINT16_C(0xFFFF);
|
u16 m_button_state = UINT16_C(0xFFFF);
|
||||||
u16 m_position_x = 0;
|
u16 m_position_x = 0;
|
||||||
u16 m_position_y = 0;
|
u16 m_position_y = 0;
|
||||||
|
bool m_shoot_offscreen = false;
|
||||||
|
|
||||||
TransferState m_transfer_state = TransferState::Idle;
|
TransferState m_transfer_state = TransferState::Idle;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user