-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPinballPoolGame.h
More file actions
365 lines (322 loc) · 14.2 KB
/
PinballPoolGame.h
File metadata and controls
365 lines (322 loc) · 14.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/**************************************************************************
Pinball Pool Game is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See <https://www.gnu.org/licenses/>.
*/
// These are exmaple values - fill these in with your machine's definitions
#define NUMBER_OF_LAMPS 60
// Lamp Numbers (defines for lamps)
#define LA_SMALL_1 0 // Small 1
#define LA_SMALL_2 1 // Small 2
#define LA_SMALL_3 2 // Small 3
#define LA_SMALL_4 3 // Small 4
#define LA_SMALL_5 4 // Small 5
#define LA_SMALL_6 5 // Small 6
#define LA_SMALL_7 6 // Small 7
#define LA_SMALL_8 7 // Small 8
#define LA_SMALL_9 8 // Small 9
#define LA_SMALL_10 9 // Small 10
#define LA_SMALL_11 10 // Small 11
#define LA_SMALL_12 11 // Small 12
#define LA_SMALL_13 12 // Small 13
#define LA_SMALL_14 13 // Small 14
#define LA_SMALL_15 14 // Small 15
#define LA_LEFT_ARROW 15 // Left Arrow
#define LA_BANK_SHOT_300 16 // Bank Shot 300 1
#define LA_BANK_SHOT_600 17 // Bank Shot 600 2
#define LA_BANK_SHOT_900 18 // Bank Shot 900 3
#define LA_BANK_SHOT_1200 19 // Bank Shot 1200 4
#define LA_BANK_SHOT_1500 20 // Bank Shot 1500 5
#define LA_BANK_SHOT_5000 21 // Bank Shot 5000 6
#define LA_OUTLANE_SPECIAL 22 // Outlane Special
#define SAME_PLAYER 23 // Same Player Shoots Again - Playfield
#define LA_BIG_1 24 // Big 1
#define LA_BIG_2 25 // Big 2
#define LA_BIG_3 26 // Big 3
#define LA_BIG_4 27 // Big 4
#define LA_BIG_5 28 // Big 5
#define LA_BIG_6 29 // Big 6
#define LA_BIG_7 30 // Big 7
#define LA_BIG_8 31 // Big 8
#define LA_BIG_9 32 // Big 9
#define LA_BIG_10 33 // Big 10
#define LA_BIG_11 34 // Big 11
#define LA_BIG_12 35 // Big 12
#define LA_BIG_13 36 // Big 13
#define LA_BIG_14 37 // Big 14
#define LA_BIG_15 38 // Big 15
#define LA_RIGHT_ARROW 39 // Right Arrow
#define LA_SPSA_BACK 40 // Same Player Shoots Again - Back Box
#define MATCH 41 // Match
#define LA_SPINNER 42 // Spinner and Kickback Arrow
#define LA_CREDIT_INDICATOR 43 // Credit Indicator
#define LA_SUPER_BONUS 44 // Super Bonus
#define LA_5X 45 // 5X
#define LA_3X 46 // 3X
#define LA_2X 47 // 2X
#define BALL_IN_PLAY 48 // Ball in Play - not working
#define HIGH_SCORE 49 // High Score
#define GAME_OVER 50 // Game Over
#define TILT 51 // Tilt
#define LA_1_PLAYER 52 // 1 Player
#define LA_2_PLAYER 53 // 2 Player
#define LA_3_PLAYER 54 // 3 Player
#define LA_4_PLAYER 55 // 4 Player
#define PLAYER_1_UP 56 // Player 1 Up
#define PLAYER_2_UP 57 // Player 2 Up
#define PLAYER_3_UP 58 // Player 3 Up
#define PLAYER_4_UP 59 // Player 4 Up
// Attract Animation Definitions
#define RACK_BALL_START 24
#define NUM_OF_TRIANGLE_LAMPS_CW 37
struct AttractLampsDown {
byte lightNumDown;
byte rowDown;
};
struct AttractLampsDown AttractLampsDown[] = {
{LA_BIG_7, 1},
{LA_BIG_11, 2},
{LA_BIG_8, 3},
{LA_BIG_4, 4},
{LA_BIG_3, 5},
{LA_BIG_2, 6},
{LA_BIG_1, 7},
{LA_BIG_6, 8},
{LA_BIG_10, 9},
{LA_BIG_13, 10},
{LA_BIG_15, 11},
{LA_BIG_14, 12},
{LA_BIG_12, 13},
{LA_BIG_9, 14},
{LA_BIG_5, 15},
{LA_BANK_SHOT_300, 16},
{LA_BANK_SHOT_600, 17},
{LA_BANK_SHOT_900, 18},
{LA_BANK_SHOT_1200, 19},
{LA_BANK_SHOT_1500, 20},
{LA_BANK_SHOT_5000, 21},
{LA_SMALL_12, 22},
{LA_SMALL_4, 23},
{TILT, 23},
{LA_SMALL_3, 24},
{LA_SMALL_11, 25},
{LA_RIGHT_ARROW, 25},
{LA_SMALL_10, 26},
{LA_SPSA_BACK, 26},
{LA_SMALL_2, 27},
{LA_LEFT_ARROW, 27},
{LA_SMALL_1, 28},
{LA_SMALL_9, 28},
{LA_4_PLAYER, 29},
{LA_3_PLAYER, 30},
{LA_2_PLAYER, 31},
{LA_1_PLAYER, 32}
};
byte LampAnimation1[12][8] = {
// Rotating bars rack area
{ 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x87, 0x01, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x41, 0x08, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x21, 0x26, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x21, 0x52, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x42, 0x52, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x04, 0x44, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x88, 0x68, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x10, 0x69, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x10, 0x1D, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00 },
};
//byte LampAnimation1a[12][8] = {
byte LampAnimation1a[15][8] = {
// Rotating bars outer lamps
{ 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00 },
{ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 },
{ 0x30, 0x30, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00 },
{ 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 }
/*
{ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
*/
};
byte LampAnimation2[13][8] = {
// Left Right Sweep
{ 0x10, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 },
{ 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x02, 0x02, 0x80, 0x00, 0x00 },
{ 0x02, 0x82, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x80, 0x04, 0x44, 0x50, 0x00, 0x00 },
{ 0x04, 0x04, 0x00, 0x80, 0xA0, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x20, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 },
{ 0x08, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00 },
{ 0x80, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x20, 0x40, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 }
};
byte LampAnimation3[15][8] = {
// 3 way sweep
// Most lamps version
/*{ 0x71, 0x00, 0x01, 0x1F, 0x00, 0x02, 0x00, 0x00 },
{ 0x00, 0x72, 0x42, 0xE0, 0x01, 0x00, 0x00, 0x00 },
{ 0x70, 0x80, 0x44, 0x00, 0x0E, 0x00, 0x00, 0x00 },
{ 0x00, 0x70, 0x48, 0x00, 0xB0, 0x00, 0x00, 0x00 },
{ 0x70, 0x74, 0x10, 0x00, 0x40, 0x02, 0x00, 0x00 },
{ 0x78, 0x00, 0x20, 0x21, 0x52, 0x02, 0x00, 0x00 },
{ 0x00, 0x78, 0x50, 0x42, 0x24, 0x00, 0x00, 0x00 },
{ 0x74, 0x00, 0x48, 0x84, 0x08, 0x00, 0x00, 0x00 },
{ 0x02, 0x70, 0x44, 0x08, 0x01, 0x00, 0x00, 0x00 },
{ 0x70, 0x01, 0x02, 0x10, 0x00, 0x02, 0x00, 0x00 },
{ 0x01, 0x71, 0x04, 0x10, 0x69, 0x02, 0x00, 0x00 },
{ 0x73, 0x83, 0x48, 0x88, 0x14, 0x00, 0x00, 0x00 },
{ 0x07, 0xF7, 0x50, 0x44, 0x82, 0x00, 0x00, 0x00 },
{ 0x7F, 0x8F, 0x48, 0x22, 0x80, 0x00, 0x00, 0x00 },
{ 0x70, 0x71, 0x04, 0x01, 0x00, 0x02, 0x00, 0x00 }*/
// Rack plus Bank Shot
{ 0x00, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x02, 0xE0, 0x01, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x04, 0x00, 0x0E, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x20, 0x21, 0x52, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x10, 0x42, 0x24, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x08, 0x84, 0x08, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x04, 0x08, 0x01, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x04, 0x10, 0x69, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x08, 0x88, 0x14, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x10, 0x44, 0x02, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00 }
};
byte LampAnimation4[5][8] = {
// Right Arrow
{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }
};
byte LampAnimation5[5][8] = {
// Left Arrow
{ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }
};
byte LampAnimation6[5][8] = {
// Downward V
{ 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 }
};
byte LampAnimation7[14][8] = {
// Downward Wave - no rack
{ 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00 },
{ 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x30, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 },
{ 0x00, 0x30, 0x00, 0x00, 0x00, 0xE4, 0x00, 0x00 },
{ 0x40, 0x00, 0x40, 0x0E, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x40, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 }
};
// Rack region large arrows
int RackLeftArrow[6] = {25, 26, 29, 30, 34, 37};
int RackRightArrow[6] = {26, 27, 31, 32, 34, 36};
int DownwardV[9] = {24, 28, 29, 32, 33, 35, 36, 37, 38};
#define NUM_OF_SWITCHES 26
// Defines for switches
#define SW_10_PTS 0
#define SW_TOP_LEFT_TARGET 1
#define SW_BANK_SHOT 2
#define SW_CREDIT_RESET 5
#define SW_TILT 6
#define SW_OUTHOLE 7
#define SW_COIN_3 9
#define SW_COIN_1 8
#define SW_COIN_2 10
#define SW_SLAM 15
#define SW_SPINNER 16
#define SW_8_BALL 24
#define SW_7_15_BALL 25
#define SW_6_14_BALL 26
#define SW_5_13_BALL 27
#define SW_4_12_BALL 28
#define SW_3_11_BALL 29
#define SW_2_10_BALL 30
#define SW_1_9_BALL 31
#define SW_RIGHT_OUTLANE 32
#define SW_LEFT_OUTLANE 33
#define SW_RIGHT_SLING 35
#define SW_LEFT_SLING 36
#define SW_BUMPER_BOTTOM 37
#define SW_BUMPER_RIGHT 38
#define SW_BUMPER_LEFT 39
// Defines for solenoids
#define SOL_CHIME_10 1 // 1
#define SOL_CHIME_100 2 // 2
#define SOL_CHIME_1000 3 // 3
#define SOL_CHIME_EXTRA 4 // 4
#define SOL_KNOCKER 5 // 5
#define SOL_OUTHOLE 6 // 6
#define SOL_KICKER 7 // 7
#define SOL_BUMPER_LEFT 8 // 8
#define SOL_BUMPER_RIGHT 9 // 9
#define SOL_BUMPER_BOTTOM 10 // 10
#define SOL_LEFT_SLING 11 // 11
#define SOL_RIGHT_SLING 13 // 13
//
// Leave Coin Lockout and and flippers out of the defintions
//
// #define SOL_COIN_LOCKOUT xx
// #define SOL_FLIPPERS 14
// SWITCHES_WITH_TRIGGERS are for switches that will automatically
// activate a solenoid (like in the case of a chime that rings on a rollover)
// but SWITCHES_WITH_TRIGGERS are fully debounced before being activated
#define NUM_SWITCHES_WITH_TRIGGERS 5
// PRIORITY_SWITCHES_WITH_TRIGGERS are switches that trigger immediately
// (like for pop bumpers or slings) - they are not debounced completely
#define NUM_PRIORITY_SWITCHES_WITH_TRIGGERS 5
// Define automatic solenoid triggers (switch, solenoid, number of 1/120ths of a second to fire)
// Put chime call before the solenoid call, seems to do things in reverse order
struct PlayfieldAndCabinetSwitch TriggeredSwitches[] = {
{ SW_LEFT_SLING, SOL_LEFT_SLING, 4 },
{ SW_RIGHT_SLING, SOL_RIGHT_SLING, 4 },
{ SW_BUMPER_LEFT, SOL_BUMPER_LEFT, 3 },
{ SW_BUMPER_RIGHT, SOL_BUMPER_RIGHT, 3 },
{ SW_BUMPER_BOTTOM, SOL_BUMPER_BOTTOM, 3 },
};