diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs index c0822e6f56..20289ea7b5 100644 --- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs @@ -48,6 +48,18 @@ namespace OpenRA.Mods.Common.Widgets { ScrollDirection.Right, "scroll-r" }, }; + static readonly Dictionary JoystickCursors = new Dictionary + { + { ScrollDirection.Up | ScrollDirection.Left, "joystick-tl-blocked" }, + { ScrollDirection.Up | ScrollDirection.Right, "joystick-tr-blocked" }, + { ScrollDirection.Down | ScrollDirection.Left, "joystick-bl-blocked" }, + { ScrollDirection.Down | ScrollDirection.Right, "joystick-br-blocked" }, + { ScrollDirection.Up, "joystick-t-blocked" }, + { ScrollDirection.Down, "joystick-b-blocked" }, + { ScrollDirection.Left, "joystick-l-blocked" }, + { ScrollDirection.Right, "joystick-r-blocked" }, + }; + static readonly Dictionary ScrollOffsets = new Dictionary { { ScrollDirection.Up, new float2(0, -1) }, @@ -147,10 +159,20 @@ namespace OpenRA.Mods.Common.Widgets public override string GetCursor(int2 pos) { - if (!Game.Settings.Game.ViewportEdgeScroll || Ui.MouseOverWidget != this) + if (!IsJoystickScrolling && + (!Game.Settings.Game.ViewportEdgeScroll || Ui.MouseOverWidget != this)) return null; var blockedDirections = worldRenderer.Viewport.GetBlockedDirections(); + + if (IsJoystickScrolling) + { + foreach (var dir in JoystickCursors) + if (blockedDirections.Includes(dir.Key)) + return dir.Value; + return "joystick-all"; + } + foreach (var dir in ScrollCursors) if (edgeDirections.Includes(dir.Key)) return dir.Value + (blockedDirections.Includes(dir.Key) ? "-blocked" : ""); diff --git a/mods/cnc/cursors.yaml b/mods/cnc/cursors.yaml index 4775bc298e..0dd8b17973 100644 --- a/mods/cnc/cursors.yaml +++ b/mods/cnc/cursors.yaml @@ -71,6 +71,22 @@ Cursors: c4-minimap: Start: 127 Length: 3 + joystick-t-blocked: + Start: 130 + joystick-tr-blocked: + Start: 131 + joystick-r-blocked: + Start: 132 + joystick-br-blocked: + Start: 133 + joystick-b-blocked: + Start: 134 + joystick-bl-blocked: + Start: 135 + joystick-l-blocked: + Start: 136 + joystick-tl-blocked: + Start: 137 # Cursors that need minimap variants deploy: @@ -105,6 +121,10 @@ Cursors: Start: 0 X: -16 Y: -12 + joystick-all: + Start: 0 + X: -16 + Y: -12 deploy-blocked: Start: 1 Length: 1 diff --git a/mods/d2k/cursors.yaml b/mods/d2k/cursors.yaml index e19615a4f4..3ab9966ef1 100644 --- a/mods/d2k/cursors.yaml +++ b/mods/d2k/cursors.yaml @@ -207,6 +207,42 @@ Cursors: Length: 8 X: 24 Y: 24 + joystick-all: + Start: 0 + X: 24 + Y: 24 + joystick-t-blocked: + Start: 180 + X: 24 + Y: 24 + joystick-tr-blocked: + Start: 188 + X: 24 + Y: 24 + joystick-r-blocked: + Start: 196 + X: 24 + Y: 24 + joystick-br-blocked: + Start: 204 + X: 24 + Y: 24 + joystick-b-blocked: + Start: 212 + X: 24 + Y: 24 + joystick-bl-blocked: + Start: 220 + X: 24 + Y: 24 + joystick-l-blocked: + Start: 228 + X: 24 + Y: 24 + joystick-tl-blocked: + Start: 236 + X: 24 + Y: 24 # Cursors that need minimap variants deploy: diff --git a/mods/ra/cursors.yaml b/mods/ra/cursors.yaml index 5c33364c8e..cc13e81cca 100644 --- a/mods/ra/cursors.yaml +++ b/mods/ra/cursors.yaml @@ -122,6 +122,26 @@ Cursors: ability-minimap: Start: 214 Length: 8 + joystick-all: + Start: 0 + X: -16 + Y: -12 + joystick-t-blocked: + Start: 124 + joystick-tr-blocked: + Start: 125 + joystick-r-blocked: + Start: 126 + joystick-br-blocked: + Start: 127 + joystick-b-blocked: + Start: 128 + joystick-bl-blocked: + Start: 129 + joystick-l-blocked: + Start: 130 + joystick-tl-blocked: + Start: 131 # Cursors that need minimap variants deploy: diff --git a/mods/ts/cursors.yaml b/mods/ts/cursors.yaml index 60d5264acb..0840893147 100644 --- a/mods/ts/cursors.yaml +++ b/mods/ts/cursors.yaml @@ -176,4 +176,22 @@ Cursors: powerdown: Start: 329 Length: 15 + joystick-all: + Start: 378 + joystick-t-blocked: + Start: 379 + joystick-tr-blocked: + Start: 380 + joystick-r-blocked: + Start: 381 + joystick-br-blocked: + Start: 382 + joystick-b-blocked: + Start: 383 + joystick-bl-blocked: + Start: 384 + joystick-l-blocked: + Start: 385 + joystick-tl-blocked: + Start: 386