Commit Graph
50 Commits
Author SHA1 Message Date
Anders Jenbo 8726e80199 Make controller enums C++03 compatible 2020-05-19 17:19:50 +02:00
Anders Jenbo dc8be6c0ab C++03 compatibility (#736)
* Use C++03 compatible constructors
* Remove conflicting definitions
2020-05-17 01:37:19 +02:00
Anders Jenbo 0da3461d35 Use explicit types instead of auto 2020-05-14 11:44:15 +02:00
Anders Jenbo 7108145a04 Merge branch 'master' of github.com:diasurgical/devilution 2020-04-14 15:30:49 +02:00
qndel fea95b8cf7 fix wrong enum 2020-04-14 10:06:54 +02:00
Anders Jenbo 776ab10476 Merge branch 'master' of github.com:diasurgical/devilution 2020-03-29 23:40:05 +02:00
Anders Jenbo 58e3192ef9 Merge branch 'master' of github.com:diasurgical/devilution
Fixes #620
2020-02-29 18:18:45 +01:00
qndel cc6a2d4523 Apply MAX_PATH_LENGTH 2020-02-01 14:53:06 +01:00
Anders Jenbo 08aa6a860a Move generic helpers out of miniwin 2020-02-01 13:56:08 +01:00
Gleb Mazovetskiy 5b2481a2b4 Controls: No virtual mouse when automap is active 2020-01-25 16:37:50 +01:00
Gleb Mazovetskiy ce5c1007a2 Controller improvements: START modifier and hints
1. Makes START a modifier key.
2. Main modifier actions are now displayed as hints while the modifier is pressed.
3. Mouse simulation now available on all controllers:
   SELECT + D-Pad to move mouse
   SELECT + Left/Right should button to click

 START +    | Action
 ---------- | ------
 SELECT     | Menu
 UP         | Menu
 DOWN       | Map
 LEFT       | Character info
 RIGHT      | Inventory
 B (Bottom) | Spell book
 Y (Left)   | Quest log

This makes all actions available on controllers without sticks and ZL/ZR.
2020-01-25 16:37:50 +01:00
Anders Jenbo cb2d58acc8 Fix clang warning 2019-12-26 17:23:21 +01:00
Anders Jenbo 57e960aeda [controller] only move map when in dungion
The map status can not be changed in town but is remembered
2019-12-26 01:55:47 +01:00
Anders Jenbo fe44ea7859 [controller] Increase teleport distance to 4 steps 2019-12-24 05:58:08 +01:00
Anders Jenbo eb0f899c90 [controller] Hot spells via mod+A/B/X/Y, quest log/spellbook via mod+L2/R2 2019-12-24 04:34:57 +01:00
Anders Jenbo cc42e9abb1 [controller] Make accumulator time based and correct map direction
The emulated mouse and map move at a consistent speed independant of
frame rate.
The map can now be scrolled at variable speeds and diagonally.
Mouse is now confined to the window.
2019-12-24 04:30:29 +01:00
Anders Jenbo 7d8d10f00e [controller] Correctly prioritice multiple talkers
This makes is easier to deal with Lazurus when skipping his trigger
2019-12-22 02:56:37 +01:00
Anders Jenbo 4610b50d1e [controller] Handle edge cases for cursor state 2019-12-21 21:11:35 +01:00
Anders Jenbo ae19742590 [controller] Don't start backtrack around obstacles 2019-12-21 19:28:47 +01:00
Anders Jenbo 9d4bb70913 [controller] Only close inventory if cursor is clean 2019-12-18 23:07:42 +01:00
Anders Jenbo f313b66a34 [controller] Fix dropping items to all sides 2019-12-18 23:06:22 +01:00
Anders Jenbo f0a614ea21 [controller] Do not cast targeted spells from inventory 2019-12-18 23:06:19 +01:00
Anders Jenbo 4269f71dc2 [controller] Fix player attack each other in town
This would render the player invisable and damage equipment
2019-12-14 21:37:18 +01:00
Anders Jenbo e7f2d6ddd4 [controller] Fix delayed movements in multiplayer 2019-12-14 21:23:03 +01:00
Anders Jenbo cdbde9cdcb [controller] Target quest entrances 2019-12-13 23:58:35 +01:00
Anders Jenbo b2c3cf1135 [controller] Correctly prioritize all targets 2019-12-08 03:29:28 +01:00
Anders Jenbo 28b4fb1fd9 [controller] Correctly prioritize monsters 2019-12-08 00:54:56 +01:00
Anders Jenbo 271c6a9c41 Remove unessesery calls to abs in GetDistanceRanged 2019-12-07 18:31:40 +01:00
Anders Jenbo e24574897c [controller] Target portals
This will target portals and stairs found within 2 steps if no other
targets are found.
This is naive and doesn't prefer portals propperly.
2019-12-07 02:35:47 +01:00
Anders Jenbo 78b9f7bc72 [controller] Only ignore doors when at same coordinates
This made it harder to use schrines and book shelfs
2019-12-06 00:13:44 +01:00
Anders Jenbo f5e8ae47c0 [controller] Correct movment range
Previously the player could wald across lava bends and sneak past
blocked paths
2019-12-06 00:13:44 +01:00
Gleb Mazovetskiy 6aae591f6c FindMelee: Minor cleanup 2019-12-04 00:12:48 +01:00
Anders Jenbo dd0cd88eb8 [controller] Single BFS mele aim 2019-11-28 02:54:44 +01:00
Max Desiatov 4ff8f586d6 Fix typo in plrctrls.cpp comment
>cordinate
2019-11-22 12:34:17 +01:00
Anders Jenbo 279535f90b Correct GetDistanceRanged calculation 2019-11-22 01:25:49 +01:00
Anders Jenbo 425262560b Check best case before doing a full path search
This gives between 2x-10x performance improvment to mele only player
auto aim performance. Further improvments could be made by ordering
enemies by minimal distance and doing a continue in while ((next_node =
GetNextPath())) if maxDistance is exceeded.
2019-11-22 01:25:49 +01:00
Anders Jenbo b3d81a46cc Ignore doorway so we don't get stuck behind barrels 2019-11-20 10:49:16 +01:00
Anders Jenbo 0c75636db3 [controller] Automatically apply heal-other, resurect and disarm 2019-11-20 10:49:16 +01:00
Anders Jenbo d94b245497 [controlls] Prioritize spell targets
Spells will now target either the apropriate highlighted actor or the
current direction.
2019-11-20 10:49:16 +01:00
Anders Jenbo 520c1515ed Check if towner is in range first
This dramatically reduces the CPU spend finding towners
2019-11-18 02:23:22 +01:00
Anders Jenbo 2bb9aa4928 * Improve controller autoaim
- Access and detect all parts of large objects
- Prioritize targets based on orientation
- Accurate prioritize the closest enemy when using mele only
- Multiple corrections to target selection logic
2019-11-12 00:28:04 +01:00
Anders Jenbo dbc91ae036 Correct mouse interactions for game controller 2019-11-06 02:13:07 +01:00
Anders Jenbo 45844b71ae Make controls more responsive
- Fix double events
- Fix ignored events
- Allow moving diagonal in the inventory
- Fix mouse wobbling in inventory when scalling
- Make controler actions cursor independants
- Make sure secoundery and primery key doesn't fire each others events
- Highlight both primary and secondary target
- 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
2019-11-06 02:13:07 +01:00
Gleb Mazovetskiy 9cf4bef738 plrctrls: Fixup checkMonstersNearby 2019-11-06 02:13:07 +01:00
Anders Jenbo e590e6995a Implement recharge and fix cursor for repair 2019-11-06 02:13:07 +01:00
Anders Jenbo c1a6244175 Make belt usage event based, also use heal scroll from belt 2019-11-06 02:13:07 +01:00
Gleb Mazovetskiy 113ef2e283 Fix item flickering 2019-11-06 02:13:07 +01:00
Gleb Mazovetskiy a2e821d241 Game controller support
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.
2019-11-06 02:13:07 +01:00
rsn8887 a1d7fe196a Fix increasing player stats infinitely 2019-11-06 02:13:07 +01:00
erfg12 3e03404ebb Keyboard and Controller support for Diablo 1
- 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
2019-11-06 02:13:07 +01:00