fix d2k cursors

- center by default (also works better for ra/cnc/ts)
This commit is contained in:
Matthias Mailänder
2013-08-15 13:07:51 +02:00
parent 40438e7fa6
commit 0a84ddc8fb
5 changed files with 25 additions and 343 deletions

View File

@@ -38,17 +38,17 @@ namespace OpenRA.Graphics
cursors = new Dictionary<string, CursorSequence>(); cursors = new Dictionary<string, CursorSequence>();
palettes = new Cache<string, PaletteReference>(CreatePaletteReference); palettes = new Cache<string, PaletteReference>(CreatePaletteReference);
var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal)); var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal));
int[] ShadowIndex = { }; var shadowIndex = new int[] { };
if (sequences.NodesDict.ContainsKey("ShadowIndex")) if (sequences.NodesDict.ContainsKey("ShadowIndex"))
{ {
Array.Resize(ref ShadowIndex, ShadowIndex.Length + 1); Array.Resize(ref shadowIndex, shadowIndex.Length + 1);
int.TryParse(sequences.NodesDict["ShadowIndex"].Value, out ShadowIndex[ShadowIndex.Length - 1]); int.TryParse(sequences.NodesDict["ShadowIndex"].Value, out shadowIndex[shadowIndex.Length - 1]);
} }
palette = new HardwarePalette(); palette = new HardwarePalette();
foreach (var p in sequences.NodesDict["Palettes"].Nodes) foreach (var p in sequences.NodesDict["Palettes"].Nodes)
palette.AddPalette(p.Key, new Palette(FileSystem.Open(p.Value.Value), ShadowIndex), false); palette.AddPalette(p.Key, new Palette(FileSystem.Open(p.Value.Value), shadowIndex), false);
foreach (var s in sequences.NodesDict["Cursors"].Nodes) foreach (var s in sequences.NodesDict["Cursors"].Nodes)
LoadSequencesForCursor(s.Key, s.Value); LoadSequencesForCursor(s.Key, s.Value);
@@ -76,7 +76,7 @@ namespace OpenRA.Graphics
renderer.SetPalette(palette); renderer.SetPalette(palette);
renderer.SpriteRenderer.DrawSprite(cursorSprite, renderer.SpriteRenderer.DrawSprite(cursorSprite,
lastMousePos - cursorSequence.Hotspot, lastMousePos - cursorSequence.Hotspot - (0.5f * cursorSprite.size).ToInt2(),
palettes[cursorSequence.Palette], palettes[cursorSequence.Palette],
cursorSprite.size); cursorSprite.size);
} }

View File

@@ -7,281 +7,173 @@ Cursors:
mouse2: cursor mouse2: cursor
scroll-t: scroll-t:
start:1 start:1
x:14
y:-2
scroll-tr: scroll-tr:
start:2 start:2
x:14
y:-2
scroll-r: scroll-r:
start:3 start:3
x:28
y:12
scroll-br: scroll-br:
start:4 start:4
x:28
y:22
scroll-b: scroll-b:
start:5 start:5
x:14
y:22
scroll-bl: scroll-bl:
start:6 start:6
x:-2
y:22
scroll-l: scroll-l:
start:7 start:7
x:-1
y:13
scroll-tl: scroll-tl:
start:8 start:8
x:-2
y:-2
scroll-t-blocked: scroll-t-blocked:
start:130 start:130
x:14
y:-2
scroll-tr-blocked: scroll-tr-blocked:
start:131 start:131
x:14
y:-2
scroll-r-blocked: scroll-r-blocked:
start:132 start:132
x:28
y:12
scroll-br-blocked: scroll-br-blocked:
start:133 start:133
x:28
y:22
scroll-b-blocked: scroll-b-blocked:
start:134 start:134
x:14
y:22
scroll-bl-blocked: scroll-bl-blocked:
start:135 start:135
x:-2
y:22
scroll-l-blocked: scroll-l-blocked:
start:136 start:136
x:-1
y:13
scroll-tl-blocked: scroll-tl-blocked:
start:137 start:137
x:-2
y:-2
select: select:
start:12 start:12
length:6 length:6
x:12
y:12
default: default:
start:0 start:0
x: -16
y: -12
default-minimap: default-minimap:
start:86 start:86
length:1 length:1
x: -16
y: -12
generic-blocked: generic-blocked:
start:9 start:9
x:12
y:12
generic-blocked-minimap: generic-blocked-minimap:
start:27 start:27
x:12
y:12
attack: attack:
start:18 start:18
length:8 length:8
x:12
y:12
attack-minimap: attack-minimap:
start:140 start:140
length:8 length:8
x:12
y:12
harvest: harvest:
start:18 start:18
length:8 length:8
x:12
y:12
harvest-minimap: harvest-minimap:
start:140 start:140
length:8 length:8
x:12
y:12
enter: enter:
start:119 start:119
length:3 length:3
x:12
y:12
enter-minimap: enter-minimap:
start:148 start:148
length:3 length:3
x:12
y:12
c4: c4:
start:122 start:122
length:3 length:3
x:12
y:12
c4-minimap: c4-minimap:
start:127 start:127
length:3 length:3
x:12
y:12
guard: guard:
start:153 start:153
length:1 length:1
x:12
y:12
guard-minimap: guard-minimap:
start:152 start:152
length:1 length:1
x:12
y:12
# Cursors that need minimap variants # Cursors that need minimap variants
deploy: deploy:
start:53 start:53
length:9 length:9
x:12
y:12
repair: repair:
start:29 start:29
length:24 length:24
x:12
y:12
repair-blocked: repair-blocked:
start:126 start:126
length:1 length:1
x:12
y:12
sell: sell:
start:62 start:62
length:24 length:24
x:12
y:12
sell-blocked: sell-blocked:
start:125 start:125
length:1 length:1
x:12
y:12
ability: ability:
start:88 start:88
length:8 length:8
x:12
y:12
nuke: nuke:
start:96 start:96
length:7 length:7
x:12
y:12
ioncannon: ioncannon:
start:103 start:103
length:16 length:16
x:12
y:12
sell-vehicle: sell-vehicle:
start:154 start:154
length:24 length:24
x:12
y:12
mouse4:cursor mouse4:cursor
move: move:
start:0 start:0
length:8 length:8
x:12
y:12
move-minimap: move-minimap:
start:9 start:9
length:4 length:4
x:12
y:12
move-rough: move-rough:
start:0 start:0
length: 8 length: 8
x: 12
y: 12
attackmove:cursor attackmove:cursor
attackmove: attackmove:
start:0 start:0
length:8 length:8
x:12
y:12
attackmove-minimap: attackmove-minimap:
start:9 start:9
length:4 length:4
x:12
y:12
move-blocked: move-blocked:
start:8 start:8
x:12
y:12
move-blocked-minimap: move-blocked-minimap:
start:13 start:13
length:1 length:1
x:12
y:12
mouse3: cursor2 mouse3: cursor2
enter-blocked: enter-blocked:
start:212 start:212
length:1 length:1
x:12
y:12
enter-blocked-minimap: enter-blocked-minimap:
start:33 start:33
length:1 length:1
capture: capture:
start:164 start:164
length:3 length:3
x:12
y:12
capture-minimap: capture-minimap:
start:167 start:167
length:3 length:3
x:12
y:12
heal: heal:
start:160 start:160
length:4 length:4
x:12
y:12
heal-minimap: heal-minimap:
start:194 start:194
length:1 length:1
x:12
y:12
ability-minimap: ability-minimap:
start:214 start:214
length:8 length:8
x:12
y:12
deploy-blocked: deploy-blocked:
start:211 start:211
length:1 length:1
x:12
y:12
goldwrench: goldwrench:
start:170 start:170
length:24 length:24
x:12
y:12
goldwrench-blocked: goldwrench-blocked:
start:213 start:213
length:1 length:1
x:12
y:12
nopower: cursor nopower: cursor
powerdown-blocked: powerdown-blocked:
start:0 start:0
length: 1 length: 1
x: 12
y: 12
powerdown: powerdown:
start:1 start:1
length: 3 length: 3
x: 12
y: 12

View File

@@ -5,78 +5,48 @@ Cursors:
mouse: cursor mouse: cursor
scroll-t: scroll-t:
start:1 start:1
x: 12
y: 12
scroll-tr: scroll-tr:
start:2 start:2
x: 12
y: 12
scroll-r: scroll-r:
start:3 start:3
x: 12
y: 12
scroll-br: scroll-br:
start:4 start:4
x: 12
y: 12
scroll-b: scroll-b:
start:5 start:5
x: 12
y: 12
scroll-bl: scroll-bl:
start:6 start:6
x: 12
y: 12
scroll-l: scroll-l:
start:7 start:7
x: 12
y: 12
scroll-tl: scroll-tl:
start:8 start:8
x: 12
y: 12
scroll-t-blocked: scroll-t-blocked:
start:124 start:124
x: 12
y: 12
scroll-tr-blocked: scroll-tr-blocked:
start:125 start:125
x: 12
y: 12
scroll-r-blocked: scroll-r-blocked:
start:126 start:126
x: 12
y: 12
scroll-br-blocked: scroll-br-blocked:
start:127 start:127
x: 12
y: 12
scroll-b-blocked: scroll-b-blocked:
start:128 start:128
x: 12
y: 12
scroll-bl-blocked: scroll-bl-blocked:
start:129 start:129
x: 12
y: 12
scroll-l-blocked: scroll-l-blocked:
start:130 start:130
x: 12
y: 12
scroll-tl-blocked: scroll-tl-blocked:
start:131 start:131
x: 12
y: 12
select: select:
start:15 start:15
length: 6 length: 6
x: 12
y: 12
default: default:
start:0 start:0
x: -16
y: -12
default-minimap: default-minimap:
start:80 start:80
x: -16
y: -12
generic-blocked: generic-blocked:
start:9 start:9
generic-blocked-minimap: generic-blocked-minimap:
@@ -84,181 +54,111 @@ Cursors:
move: move:
start:10 start:10
length: 4 length: 4
x: 12
y: 12
move-minimap: move-minimap:
start:29 start:29
length: 4 length: 4
x: 12
y: 12
move-rough: move-rough:
start:10 start:10
length: 4 length: 4
x: 12
y: 12
move-blocked: move-blocked:
start:14 start:14
x: 12
y: 12
move-blocked-minimap: move-blocked-minimap:
start:33 start:33
x: 12
y: 12
attack: attack:
start:195 start:195
length: 8 length: 8
x: 12
y: 12
attack-minimap: attack-minimap:
start:203 start:203
length: 8 length: 8
x: 12
y: 12
attackmove: attackmove:
start:21 start:21
length: 8 length: 8
x: 12
y: 12
attackmove-minimap: attackmove-minimap:
start:134 start:134
length: 8 length: 8
x: 12
y: 12
harvest: harvest:
start:21 start:21
length: 8 length: 8
x: 12
y: 12
harvest-minimap: harvest-minimap:
start:134 start:134
length: 8 length: 8
x: 12
y: 12
enter: enter:
start:113 start:113
length: 3 length: 3
x: 12
y: 12
enter-minimap: enter-minimap:
start:139 start:139
length: 3 length: 3
x: 12
y: 12
enter-blocked: enter-blocked:
start:212 start:212
length: 1 length: 1
x: 12
y: 12
enter-blocked-minimap: enter-blocked-minimap:
start:33 start:33
c4: c4:
start:116 start:116
length: 3 length: 3
x: 12
y: 12
c4-minimap: c4-minimap:
start:121 start:121
length: 3 length: 3
x: 12
y: 12
guard: guard:
start:147 start:147
length: 1 length: 1
x: 12
y: 12
guard-minimap: guard-minimap:
start:146 start:146
length: 1 length: 1
x: 12
y: 12
capture: capture:
start:164 start:164
length: 3 length: 3
x: 12
y: 12
capture-minimap: capture-minimap:
start:167 start:167
length: 3 length: 3
x: 12
y: 12
heal: heal:
start:160 start:160
length: 4 length: 4
x: 12
y: 12
heal-minimap: heal-minimap:
start:194 start:194
length: 1 length: 1
x: 12
y: 12
ability: ability:
start:82 start:82
length: 8 length: 8
x: 12
y: 12
ability-minimap: ability-minimap:
start:214 start:214
length: 8 length: 8
x: 12
y: 12
# Cursors that need minimap variants # Cursors that need minimap variants
deploy: deploy:
start:59 start:59
length: 9 length: 9
x: 12
y: 12
deploy-blocked: deploy-blocked:
start:211 start:211
length: 1 length: 1
x: 12
y: 12
goldwrench: goldwrench:
start:170 start:170
length: 24 length: 24
x: 12
y: 12
goldwrench-blocked: goldwrench-blocked:
start:213 start:213
length: 1 length: 1
x: 12
y: 12
nuke: nuke:
start:90 start:90
length: 7 length: 7
x: 12
y: 12
chrono-select: chrono-select:
start:97 start:97
length: 8 length: 8
x: 12
y: 12
chrono-target: chrono-target:
start:105 start:105
length: 8 length: 8
x: 12
y: 12
sell: sell:
start:68 start:68
length: 12 length: 12
x: 12
y: 12
sell-blocked: sell-blocked:
start:119 start:119
length: 1 length: 1
x: 12
y: 12
repair: repair:
start:35 start:35
length: 24 length: 24
x: 12
y: 12
repair-blocked: repair-blocked:
start:120 start:120
length: 1 length: 1
x: 12
y: 12
sell2: sell2:
start:148 start:148
length: 12 length: 12
@@ -267,10 +167,6 @@ Cursors:
powerdown-blocked: powerdown-blocked:
start:0 start:0
length: 1 length: 1
x: 12
y: 12
powerdown: powerdown:
start:1 start:1
length: 3 length: 3
x: 12
y: 12

View File

@@ -5,77 +5,47 @@ Cursors:
mouse: cursor mouse: cursor
scroll-t: #TODO scroll-t: #TODO
start:1 start:1
x: 12
y: 12
scroll-tr: #TODO scroll-tr: #TODO
start: 2 start: 2
x: 12
y: 12
scroll-r: #TODO scroll-r: #TODO
start: 3 start: 3
x: 12
y: 12
scroll-br: #TODO scroll-br: #TODO
start: 4 start: 4
x: 12
y: 12
scroll-b: #TODO scroll-b: #TODO
start:5 start:5
x: 12
y: 12
scroll-bl: #TODO scroll-bl: #TODO
start:6 start:6
x: 12
y: 12
scroll-l: #TODO scroll-l: #TODO
start:7 start:7
x: 12
y: 12
scroll-tl: #TODO scroll-tl: #TODO
start:8 start:8
x: 12
y: 12
scroll-t-blocked: #TODO scroll-t-blocked: #TODO
start:124 start:124
x: 12
y: 12
scroll-tr-blocked: #TODO scroll-tr-blocked: #TODO
start:125 start:125
x: 12
y: 12
scroll-r-blocked: #TODO scroll-r-blocked: #TODO
start:126 start:126
x: 12
y: 12
scroll-br-blocked: #TODO scroll-br-blocked: #TODO
start:127 start:127
x: 12
y: 12
scroll-b-blocked: #TODO scroll-b-blocked: #TODO
start:128 start:128
x: 12
y: 12
scroll-bl-blocked: #TODO scroll-bl-blocked: #TODO
start:129 start:129
x: 12
y: 12
scroll-l-blocked: #TODO scroll-l-blocked: #TODO
start:130 start:130
x: 12
y: 12
scroll-tl-blocked:#TODO scroll-tl-blocked:#TODO
start:131 start:131
x: 12
y: 12
select: select:
start:18 start:18
length: 12 length: 12
x: 12
y: 12
default: default:
start:0 start:0
x: -26
y: -20
default-minimap: default-minimap:
start:1 start:1
x: -26
y: -20
generic-blocked: generic-blocked:
start:9 start:9
generic-blocked-minimap: generic-blocked-minimap:
@@ -83,193 +53,117 @@ Cursors:
move: move:
start:31 start:31
length: 10 length: 10
x: 12
y: 12
move-minimap: move-minimap:
start:42 start:42
length: 10 length: 10
x: 12
y: 12
move-rough: move-rough:
start:31 start:31
length: 10 length: 10
x: 12
y: 12
move-blocked: move-blocked:
start:41 start:41
x: 12
y: 12
move-blocked-minimap: move-blocked-minimap:
start:52 start:52
x: 12
y: 12
attack: attack:
start: 31 start: 31
length: 10 length: 10
x: 12
y: 12
attack-blocked: # TODO: unused attack-blocked: # TODO: unused
start: 32 start: 32
length: 1 length: 1
x: 12
y: 12
attack-minimap: attack-minimap:
start: 42 start: 42
length: 10 length: 10
x: 12
y: 12
attackmove: #TODO attackmove: #TODO
start:21 start:21
length: 8 length: 8
x: 12
y: 12
attackmove-minimap: #TODO attackmove-minimap: #TODO
start:134 start:134
length: 8 length: 8
x: 12
y: 12
harvest: #TODO harvest: #TODO
start:21 start:21
length: 8 length: 8
x: 12
y: 12
harvest-minimap: #TODO harvest-minimap: #TODO
start:134 start:134
length: 8 length: 8
x: 12
y: 12
enter: #TODO enter: #TODO
start:113 start:113
length: 3 length: 3
x: 12
y: 12
enter-minimap: #TODO enter-minimap: #TODO
start:139 start:139
length: 3 length: 3
x: 12
y: 12
enter-blocked: #TODO enter-blocked: #TODO
start:212 start:212
length: 1 length: 1
x: 12
y: 12
enter-blocked-minimap: #TODO enter-blocked-minimap: #TODO
start:33 start:33
c4: #TODO c4: #TODO
start:116 start:116
length: 3 length: 3
x: 12
y: 12
c4-minimap: #TODO c4-minimap: #TODO
start:121 start:121
length: 3 length: 3
x: 12
y: 12
guard: #TODO guard: #TODO
start:147 start:147
length: 1 length: 1
x: 12
y: 12
guard-minimap: #TODO guard-minimap: #TODO
start:146 start:146
length: 1 length: 1
x: 12
y: 12
capture: #TODO capture: #TODO
start:164 start:164
length: 3 length: 3
x: 12
y: 12
capture-minimap: #TODO capture-minimap: #TODO
start:167 start:167
length: 3 length: 3
x: 12
y: 12
heal: #TODO heal: #TODO
start:160 start:160
length: 4 length: 4
x: 12
y: 12
heal-minimap: #TODO heal-minimap: #TODO
start:194 start:194
length: 1 length: 1
x: 12
y: 12
ability: #TODO ability: #TODO
start:82 start:82
length: 8 length: 8
x: 12
y: 12
ability-minimap: #TODO ability-minimap: #TODO
start:214 start:214
length: 8 length: 8
x: 12
y: 12
deploy: deploy:
start:110 start:110
length: 9 length: 9
x: 12
y: 12
deploy-blocked: deploy-blocked:
start:119 start:119
length: 1 length: 1
x: 12
y: 12
undeploy: #TODO: unused undeploy: #TODO: unused
start:120 start:120
length: 9 length: 9
x: 12
y: 12
goldwrench: #TODO goldwrench: #TODO
start:170 start:170
length: 24 length: 24
x: 12
y: 12
goldwrench-blocked: #TODO goldwrench-blocked: #TODO
start:213 start:213
length: 1 length: 1
x: 12
y: 12
nuke: #TODO nuke: #TODO
start:90 start:90
length: 7 length: 7
x: 12
y: 12
sell: sell:
start:129 start:129
length: 10 length: 10
x: 12
y: 12
sell-minimap: #TODO: unused sell-minimap: #TODO: unused
start:139 start:139
length: 10 length: 10
x: 12
y: 12
sell-blocked: sell-blocked:
start:149 start:149
length: 1 length: 1
x: 12
y: 12
repair: repair:
start:170 start:170
length: 20 length: 20
x: 12
y: 12
repair-blocked: repair-blocked:
start:190 start:190
length: 1 length: 1
x: 12
y: 12
sell2: #TODO ? sell2: #TODO ?
start:148 start:148
length: 12 length: 12
powerdown-blocked: powerdown-blocked:
start:345 start:345
length: 1 length: 1
x: 12
y: 12
powerdown: powerdown:
start:329 start:329
length: 15 length: 15
x: 12
y: 12