Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle scaling for SDL1 #5

Closed
wants to merge 24 commits into from
Closed

Handle scaling for SDL1 #5

wants to merge 24 commits into from

Conversation

glebm
Copy link
Owner

@glebm glebm commented Nov 4, 2019

Background: Only some handheld devices support auto-scaling.
On desktop and most handhelds we need to scale manually.

Hardware auto-scaler check for jz4760 provided by @jbanes and @scooterpsu

erfg12 and others added 24 commits November 4, 2019 20:16
- Hide cursor on joystick move, show cursor on mouse move.
- Auto aim at closest monsters, objs or items.
- Inventory grid snap navigation
- Speed spell grid snap navigation
- Char stat snaps navigation
- Town portal auto casts if using a controller
- Can now identify and repair items via controller
- Can dropping items in inventory via controller
- Left stick click for quest log
- Y in inventory to read books
- Fix increasing player stats infinitely
- Fix inventory controls with stick or dpad
Initial game controller support.

Actions are based on the Switch branch but the controller code itself is
implemented differently, allowing for easy remapping and minimizing
changes to the Source/ directory.

Many subtle and not so subtle controller bugs have been fixed
in this implementation, including:

1. Smoother & more responsive movement with the joysticks.
2. Consistent controls for all the menus in the game (stores, quest log,
etc).
3. Cursor appearance / disappearance at appropriate times.

Low-level controls are abstracted and 3 SDL interfaces are supported:
game controller, joystick, and keyboard. See SourceX/controls/ for more
details on this.

Wishlist for the future:

1. Primary button and use button should attack continously.
   This is hard as it requires checking the cooldowns / attack speed.
2. Quick spell menu navigation is very buggy. It is also buggy in the
   switch branch. I haven't had a change to investigate.
Previously the item was just destroyed instead
- Fix double events
- Fix ignored events
- Allow moving diagonal in the inventory
- Fix mouse wabeling in inventory when scalling
- Make controler actions cursor independant
- Make sure secoundery and primery key doesn't fire each others events
- Automatic switch between controller and keyboard+mouse
- Allow the user to change facing direction when blocked
- Make code event based instead of relying on time outs
- Rename curHidden to sgbControllerActive to make it more descriptive
- Fix mouse controls (was was interupted after 1 step)
Background: Only some handheld devices support auto-scaling.
On desktop and most handhelds we need to scale manually.

Hardware auto-scaler check for jz4760 provided by @jbanes and @scooterpsu
@glebm glebm closed this Nov 14, 2019
@glebm glebm deleted the upscaling-fixes branch November 14, 2019 07:21
glebm added a commit that referenced this pull request Mar 23, 2021
Single-player difficulty selection was implemented in a very hacky way.

Documents what's going on there and fixes a memory leak.

Memory leaks that this fixes looked like this:

```
Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f435b789f17 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.6+0xb1f17)
    #1 0x5567766c62b8 in dvl::selgame_GameSelection_Select(int) ../SourceX/DiabloUI/selgame.cpp:163
    #2 0x5567766d8ee8 in dvl::selhero_Load_Select(int) ../SourceX/DiabloUI/selhero.cpp:464
    #3 0x5567766d6ed1 in dvl::selhero_List_Select(int) ../SourceX/DiabloUI/selhero.cpp:325
    #4 0x556776692683 in dvl::UiFocusNavigationSelect() ../SourceX/DiabloUI/diabloui.cpp:396
    #5 0x55677669158e in HandleMenuAction ../SourceX/DiabloUI/diabloui.cpp:223
    #6 0x5567766917b9 in dvl::UiFocusNavigation(SDL_Event*) ../SourceX/DiabloUI/diabloui.cpp:277
    #7 0x556776695dff in dvl::UiPollAndRender() ../SourceX/DiabloUI/diabloui.cpp:626
    #8 0x5567766d94ef in UiSelHeroDialog ../SourceX/DiabloUI/selhero.cpp:512
    diasurgical#9 0x5567766d997f in dvl::UiSelHeroSingDialog(int (*)(int (*)(dvl::_uiheroinfo*)), int (*)(dvl::_uiheroinfo*), int (*)(dvl::_uiheroinfo*), void (*)(unsigned int, dvl::_uidefaultstats*), int*, char (*) [16], int*) ../SourceX/DiabloUI/selhero.cpp:547
    diasurgical#10 0x556776a44f45 in mainmenu_select_hero_dialog ../Source/mainmenu.cpp:98
    diasurgical#11 0x5567765f9f15 in SNetInitializeProvider ../SourceX/storm/storm_net.cpp:102
    diasurgical#12 0x556776c996b9 in multi_init_single ../Source/multi.cpp:826
    diasurgical#13 0x556776c98b1e in NetInit ../Source/multi.cpp:770
    diasurgical#14 0x5567767d0c0b in StartGame ../Source/diablo.cpp:375
    diasurgical#15 0x556776a4493d in mainmenu_init_menu ../Source/mainmenu.cpp:45
    diasurgical#16 0x556776a44c05 in mainmenu_single_player ../Source/mainmenu.cpp:61
    diasurgical#17 0x556776a454a9 in mainmenu_loop ../Source/mainmenu.cpp:152
    diasurgical#18 0x5567767d2892 in DiabloMain ../Source/diablo.cpp:602
    diasurgical#19 0x5567766e3c69 in main ../SourceX/main.cpp:34
    diasurgical#20 0x7f435a69ecb1 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28cb1)
```
glebm added a commit that referenced this pull request Mar 23, 2021
Single-player difficulty selection was implemented in a very hacky way.

Documents what's going on there and fixes a memory leak.

Memory leaks that this fixes looked like this:

```
Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f435b789f17 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.6+0xb1f17)
    #1 0x5567766c62b8 in dvl::selgame_GameSelection_Select(int) ../SourceX/DiabloUI/selgame.cpp:163
    #2 0x5567766d8ee8 in dvl::selhero_Load_Select(int) ../SourceX/DiabloUI/selhero.cpp:464
    #3 0x5567766d6ed1 in dvl::selhero_List_Select(int) ../SourceX/DiabloUI/selhero.cpp:325
    #4 0x556776692683 in dvl::UiFocusNavigationSelect() ../SourceX/DiabloUI/diabloui.cpp:396
    #5 0x55677669158e in HandleMenuAction ../SourceX/DiabloUI/diabloui.cpp:223
    #6 0x5567766917b9 in dvl::UiFocusNavigation(SDL_Event*) ../SourceX/DiabloUI/diabloui.cpp:277
    #7 0x556776695dff in dvl::UiPollAndRender() ../SourceX/DiabloUI/diabloui.cpp:626
    #8 0x5567766d94ef in UiSelHeroDialog ../SourceX/DiabloUI/selhero.cpp:512
    diasurgical#9 0x5567766d997f in dvl::UiSelHeroSingDialog(int (*)(int (*)(dvl::_uiheroinfo*)), int (*)(dvl::_uiheroinfo*), int (*)(dvl::_uiheroinfo*), void (*)(unsigned int, dvl::_uidefaultstats*), int*, char (*) [16], int*) ../SourceX/DiabloUI/selhero.cpp:547
    diasurgical#10 0x556776a44f45 in mainmenu_select_hero_dialog ../Source/mainmenu.cpp:98
    diasurgical#11 0x5567765f9f15 in SNetInitializeProvider ../SourceX/storm/storm_net.cpp:102
    diasurgical#12 0x556776c996b9 in multi_init_single ../Source/multi.cpp:826
    diasurgical#13 0x556776c98b1e in NetInit ../Source/multi.cpp:770
    diasurgical#14 0x5567767d0c0b in StartGame ../Source/diablo.cpp:375
    diasurgical#15 0x556776a4493d in mainmenu_init_menu ../Source/mainmenu.cpp:45
    diasurgical#16 0x556776a44c05 in mainmenu_single_player ../Source/mainmenu.cpp:61
    diasurgical#17 0x556776a454a9 in mainmenu_loop ../Source/mainmenu.cpp:152
    diasurgical#18 0x5567767d2892 in DiabloMain ../Source/diablo.cpp:602
    diasurgical#19 0x5567766e3c69 in main ../SourceX/main.cpp:34
    diasurgical#20 0x7f435a69ecb1 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28cb1)
```
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.

4 participants