0
|
1 /*
|
|
2 * $Id$
|
|
3 */
|
|
4 #include <stdio.h>
|
|
5 #include <stdlib.h>
|
|
6 #include "libps2.h"
|
|
7 #include "ps2util.h"
|
|
8 #include "col.h"
|
|
9 #include "field.h"
|
|
10 #include "car.h"
|
|
11 #include "controler.h"
|
|
12 #include "game.h"
|
|
13
|
|
14 SGO_PAD pad;
|
|
15
|
|
16 #ifdef DEMO_CREATE
|
|
17 extern void setPadValue(int pad);
|
|
18 #endif
|
|
19 extern int getPadValue();
|
|
20
|
|
21 Bool
|
|
22 padCheck()
|
|
23 {
|
|
24 int pad1;
|
|
25
|
|
26 pad1 = sjoy_get_ps2_button( JOYPAD_1 );
|
|
27
|
|
28 if (pad1 & SJOY_PS2_START) {
|
2
|
29 pad.st += (pad.st < 2) ? 1 : 0;
|
0
|
30 } else {
|
|
31 pad.st = 0;
|
|
32 }
|
|
33
|
|
34 if (pad1 & SJOY_PS2_SELECT) {
|
2
|
35 pad.se += (pad.se < 2) ? 1 : 0;
|
0
|
36 } else {
|
|
37 pad.se = 0;
|
|
38 }
|
|
39 if (pad1 & SJOY_PS2_LEFT) {
|
2
|
40 pad.left += (pad.left < 2) ? 1 : 0;
|
0
|
41 } else {
|
|
42 pad.left = 0;
|
|
43 }
|
|
44 if (pad1 & SJOY_PS2_RIGHT) {
|
2
|
45 pad.right += (pad.right < 2) ? 1 : 0;
|
0
|
46 } else {
|
|
47 pad.right = 0;
|
|
48 }
|
|
49 if (pad1 & SJOY_PS2_UP) {
|
2
|
50 pad.up += (pad.up < 2) ? 1 : 0;
|
0
|
51 } else {
|
|
52 pad.up = 0;
|
|
53 }
|
|
54 if (pad1 & SJOY_PS2_DOWN) {
|
2
|
55 pad.down += (pad.down < 2) ? 1 : 0;
|
0
|
56 } else {
|
|
57 pad.down = 0;
|
|
58 }
|
|
59 if (pad1 & SJOY_PS2_R1) {
|
2
|
60 pad.r1 += (pad.r1 < 2) ? 1 : 0;
|
0
|
61 } else {
|
|
62 pad.r1 = 0;
|
|
63 }
|
|
64 if (pad1 & SJOY_PS2_R2) {
|
2
|
65 pad.r2 += (pad.r2 < 2) ? 1 : 0;
|
0
|
66 } else {
|
|
67 pad.r2 = 0;
|
|
68 }
|
|
69 if (pad1 & SJOY_PS2_L1) {
|
2
|
70 pad.l1 += (pad.l1 < 2) ? 1 : 0;
|
0
|
71 } else {
|
|
72 pad.l1 = 0;
|
|
73 }
|
|
74 if (pad1 & SJOY_PS2_L2) {
|
2
|
75 pad.l2 += (pad.l2 < 2) ? 1 : 0;
|
0
|
76 } else {
|
|
77 pad.l2 = 0;
|
|
78 }
|
|
79 if (pad1 & SJOY_PS2_CROSS) {
|
2
|
80 pad.cross += (pad.cross < 2) ? 1 : 0;
|
0
|
81 } else {
|
|
82 pad.cross = 0;
|
|
83 }
|
|
84 if (pad1 & SJOY_PS2_CIRCLE) {
|
2
|
85 pad.circle += (pad.circle < 2) ? 1 : 0;
|
0
|
86 } else {
|
|
87 pad.circle = 0;
|
|
88 }
|
|
89 if (pad1 & SJOY_PS2_TRIANGLE) {
|
2
|
90 pad.triangle += (pad.triangle < 2) ? 1 : 0;
|
0
|
91 } else {
|
|
92 pad.triangle = 0;
|
|
93 }
|
|
94 if (pad1 & SJOY_PS2_SQUARE) {
|
2
|
95 pad.square += (pad.square < 2) ? 1 : 0;
|
0
|
96 } else {
|
|
97 pad.square = 0;
|
|
98 }
|
|
99
|
|
100 if ( (pad1 & SJOY_PS2_SELECT) && (pad1 & SJOY_PS2_START) &&
|
|
101 (pad1 & SJOY_PS2_L1) && (pad1 & SJOY_PS2_R1) &&
|
|
102 (pad1 & SJOY_PS2_L2) && (pad1 & SJOY_PS2_R2)) {
|
|
103 return FALSE;
|
|
104 }
|
|
105
|
|
106 return TRUE;
|
|
107 }
|