Skip to content

Commit f65b16c

Browse files
committed
misc: allow game definition coils to override default coils. update rock definition
1 parent 9c6bf54 commit f65b16c

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

VisualPinball.Engine.PinMAME/Games/Rock.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System;
2020
using VisualPinball.Engine.Game.Engines;
2121
using VisualPinball.Engine.PinMAME.MPUs;
22-
using VisualPinball.Engine.Common;
2322

2423
namespace VisualPinball.Engine.PinMAME.Games
2524
{
@@ -71,7 +70,7 @@ public class Rock : System80
7170
};
7271

7372
public override GamelogicEngineLamp[] AvailableLamps { get; } = {
74-
new GamelogicEngineLamp("01") { Description = "Lamp 1", Type = LampType.SingleOffOn, DeviceHint = "^LampGroup1$" },
73+
new GamelogicEngineLamp("01") { Description = "Lamp 1" },
7574
new GamelogicEngineLamp("03") { Description = "Shoot Again" },
7675
new GamelogicEngineLamp("05") { Description = "#1 Drop Target (Upper)" },
7776
new GamelogicEngineLamp("06") { Description = "#2 Drop Target (Upper)" },
@@ -80,8 +79,8 @@ public class Rock : System80
8079
new GamelogicEngineLamp("09") { Description = "Level 1" },
8180
new GamelogicEngineLamp("10") { Description = "Level 2" },
8281
new GamelogicEngineLamp("11") { Description = "Level 3" },
83-
new GamelogicEngineLamp("12") { Description = "Lamp 12", DeviceHint = "^(L12|LampGroup12)$", NumMatches = 2 },
84-
new GamelogicEngineLamp("13") { Description = "Lamp 13", DeviceHint = "^(L13[a-b]|LampGroup13)$", NumMatches = 3 },
82+
new GamelogicEngineLamp("12") { Description = "Lamp 12" },
83+
new GamelogicEngineLamp("13") { Description = "Lamp 13", DeviceHint = "^L13[a-b]$", NumMatches = 2 },
8584
new GamelogicEngineLamp("14") { Description = "#1 Drop Target (Lower)" },
8685
new GamelogicEngineLamp("15") { Description = "#2 Drop Target (Lower)" },
8786
new GamelogicEngineLamp("16") { Description = "#3 Drop Target (Lower)" },
@@ -124,12 +123,10 @@ public class Rock : System80
124123
new GamelogicEngineCoil("06", 6) { Description = "Four Pos. Bank Reset", DeviceHint = "^4PosBank\\s*" },
125124
new GamelogicEngineCoil("08", 8) { Description = "Knocker Assembly" },
126125
new GamelogicEngineCoil("09", 9) { Description = "Outhole", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "eject_coil" },
127-
128-
new GamelogicEngineCoil(CoilFlipperLowerRight, 46) { Description = "Right Flippers", DeviceHint = "^(Upper|Lower)RightFlipper$", NumMatches = 2 },
129-
new GamelogicEngineCoil(CoilFlipperLowerLeft, 48) { Description = "Left Flippers", DeviceHint = "^(Upper|Lower)LeftFlipper$", NumMatches = 2 },
130-
131-
new GamelogicEngineCoil(CoilFlipperUpperRight, 34) { IsUnused = true },
132-
new GamelogicEngineCoil(CoilFlipperUpperLeft, 36) { IsUnused = true },
126+
new GamelogicEngineCoil(CoilFlipperUpperRight, 45) { Description = "Upper Right Flipper", DeviceHint = "^UpperRightFlipper$" },
127+
new GamelogicEngineCoil(CoilFlipperLowerRight, 46) { Description = "Lower Right Flipper", DeviceHint = "^LowerRightFlipper$" },
128+
new GamelogicEngineCoil(CoilFlipperUpperLeft, 47) { Description = "Upper Left Flipper", DeviceHint = "^UpperLeftFlipper$" },
129+
new GamelogicEngineCoil(CoilFlipperLowerLeft, 48) { Description = "Lower Left Flipper", DeviceHint = "^LowerLeftFlipper$" },
133130
};
134131
}
135132
}

VisualPinball.Engine.PinMAME/PinMameGame.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ public abstract class PinMameGame
9898

9999
protected GamelogicEngineCoil[] Concat(IEnumerable<GamelogicEngineCoil> parent, IEnumerable<GamelogicEngineCoil> children)
100100
{
101-
var c = parent.ToDictionary(s => s.InternalId, s => s);
101+
var ids = parent.ToDictionary(s => s.Id, s => s);
102+
foreach (var child in children) {
103+
if (ids.ContainsKey(child.Id)) {
104+
ids.Remove(child.Id);
105+
}
106+
}
107+
var c = ids.Values.ToDictionary(s => s.InternalId, s => s);
102108
foreach (var child in children) {
103109
c[child.InternalId] = child;
104110
}

0 commit comments

Comments
 (0)