1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-11-21 21:22:44 +00:00

Fix button mapping icons for Nintendo controllers

This commit is contained in:
Dr. Glaucous 2024-06-23 13:18:17 -04:00 committed by alula
parent c19d0738fa
commit 44d5893a7a

View file

@ -1575,31 +1575,42 @@ impl EngineConstants {
string_table: HashMap::new(), string_table: HashMap::new(),
missile_flags: vec![200, 201, 202, 218, 550, 766, 880, 920, 1551], missile_flags: vec![200, 201, 202, 218, 550, 766, 880, 920, 1551],
locales: Vec::new(), locales: Vec::new(),
gamepad: GamepadConsts { gamepad: {
button_rects: HashMap::from([ let mut holder = GamepadConsts {
(Button::North, GamepadConsts::rects(Rect::new(0, 0, 32, 16))), button_rects: HashMap::from([
(Button::South, GamepadConsts::rects(Rect::new(0, 16, 32, 32))), (Button::North, GamepadConsts::rects(Rect::new(0, 0, 32, 16))),
(Button::East, GamepadConsts::rects(Rect::new(0, 32, 32, 48))), (Button::South, GamepadConsts::rects(Rect::new(0, 16, 32, 32))),
(Button::West, GamepadConsts::rects(Rect::new(0, 48, 32, 64))), (Button::East, GamepadConsts::rects(Rect::new(0, 32, 32, 48))),
(Button::DPadDown, GamepadConsts::rects(Rect::new(0, 64, 32, 80))), (Button::West, GamepadConsts::rects(Rect::new(0, 48, 32, 64))),
(Button::DPadUp, GamepadConsts::rects(Rect::new(0, 80, 32, 96))), (Button::DPadDown, GamepadConsts::rects(Rect::new(0, 64, 32, 80))),
(Button::DPadRight, GamepadConsts::rects(Rect::new(0, 96, 32, 112))), (Button::DPadUp, GamepadConsts::rects(Rect::new(0, 80, 32, 96))),
(Button::DPadLeft, GamepadConsts::rects(Rect::new(0, 112, 32, 128))), (Button::DPadRight, GamepadConsts::rects(Rect::new(0, 96, 32, 112))),
(Button::LeftShoulder, GamepadConsts::rects(Rect::new(32, 32, 64, 48))), (Button::DPadLeft, GamepadConsts::rects(Rect::new(0, 112, 32, 128))),
(Button::RightShoulder, GamepadConsts::rects(Rect::new(32, 48, 64, 64))), (Button::LeftShoulder, GamepadConsts::rects(Rect::new(32, 32, 64, 48))),
(Button::Start, GamepadConsts::rects(Rect::new(32, 96, 64, 112))), (Button::RightShoulder, GamepadConsts::rects(Rect::new(32, 48, 64, 64))),
(Button::Back, GamepadConsts::rects(Rect::new(32, 112, 64, 128))), (Button::Start, GamepadConsts::rects(Rect::new(32, 96, 64, 112))),
(Button::LeftStick, GamepadConsts::rects(Rect::new(32, 0, 64, 16))), (Button::Back, GamepadConsts::rects(Rect::new(32, 112, 64, 128))),
(Button::RightStick, GamepadConsts::rects(Rect::new(32, 16, 64, 32))), (Button::LeftStick, GamepadConsts::rects(Rect::new(32, 0, 64, 16))),
]), (Button::RightStick, GamepadConsts::rects(Rect::new(32, 16, 64, 32))),
axis_rects: HashMap::from([ ]),
(Axis::LeftX, GamepadConsts::rects(Rect::new(32, 0, 64, 16))), axis_rects: HashMap::from([
(Axis::LeftY, GamepadConsts::rects(Rect::new(32, 0, 64, 16))), (Axis::LeftX, GamepadConsts::rects(Rect::new(32, 0, 64, 16))),
(Axis::RightX, GamepadConsts::rects(Rect::new(32, 16, 64, 32))), (Axis::LeftY, GamepadConsts::rects(Rect::new(32, 0, 64, 16))),
(Axis::RightY, GamepadConsts::rects(Rect::new(32, 16, 64, 32))), (Axis::RightX, GamepadConsts::rects(Rect::new(32, 16, 64, 32))),
(Axis::TriggerLeft, GamepadConsts::rects(Rect::new(32, 64, 64, 80))), (Axis::RightY, GamepadConsts::rects(Rect::new(32, 16, 64, 32))),
(Axis::TriggerRight, GamepadConsts::rects(Rect::new(32, 80, 64, 96))), (Axis::TriggerLeft, GamepadConsts::rects(Rect::new(32, 64, 64, 80))),
]), (Axis::TriggerRight, GamepadConsts::rects(Rect::new(32, 80, 64, 96))),
]),
};
// Swap x-y and a-b buttons on nintendo map (must be done here to comply with the nicalis button table)
let button = holder.button_rects.get(&Button::North).unwrap()[3].clone();
holder.button_rects.get_mut(&Button::North).unwrap()[3] = holder.button_rects.get(&Button::West).unwrap()[3];
holder.button_rects.get_mut(&Button::West).unwrap()[3] = button;
let button = holder.button_rects.get(&Button::South).unwrap()[3].clone();
holder.button_rects.get_mut(&Button::South).unwrap()[3] = holder.button_rects.get(&Button::East).unwrap()[3];
holder.button_rects.get_mut(&Button::East).unwrap()[3] = button;
holder
}, },
stage_encoding: None, stage_encoding: None,
} }