Skip to content

Conversation

@DrGlaucous
Copy link
Contributor

No description provided.

Comment on lines +1606 to +1611
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;
Copy link
Member

@alula alula Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes like no sense at all? There's no condition for Nintendo controllers and this has the same effect as swapping rectangle definitions in code you've removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nintendo controller mapping comes from rect index 3, which is the index of the buttons I'm swapping. The other indexes, 0 through 2 are left unmodified. They would be changed as well if I simply swapped definitions in the old code.

The current code creates a set of 4 Rects for each Button in the hashmap. (see GampadConsts::rects) This code assumes the buttons for each system will be in the same order, but if this were the case, the buttons for the Nintendo controllers would be reversed. Swapping the buttons in the image file isn't an option because d-rs loads the button image assets from the Nicalis ports, which can't be distributed with the engine. The game has to bend to accommodate those assets.

@alula alula merged commit 44d5893 into doukutsu-rs:master Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants