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 #ifdef DEMO_CREATE
|
|
29 if (game.state == GAME_MAIN)
|
|
30 setPadValue(pad1);
|
|
31 #endif
|
|
32
|
|
33 if (pad1 & SJOY_PS2_START) {
|
|
34 pad.st += (pad.st > 100) ? 0 : 1;
|
|
35 } else {
|
|
36 pad.st = 0;
|
|
37 }
|
|
38
|
|
39 if (game.demo_flg == 1) {
|
|
40 pad1 = getPadValue();
|
|
41 }
|
|
42
|
|
43 if (pad1 & SJOY_PS2_SELECT) {
|
|
44 pad.se += (pad.se > 100) ? 0 : 1;
|
|
45 } else {
|
|
46 pad.se = 0;
|
|
47 }
|
|
48 if (pad1 & SJOY_PS2_LEFT) {
|
|
49 pad.left += (pad.left > 100) ? 0 : 1;
|
|
50 } else {
|
|
51 pad.left = 0;
|
|
52 }
|
|
53 if (pad1 & SJOY_PS2_RIGHT) {
|
|
54 pad.right += (pad.right > 100) ? 0 : 1;
|
|
55 } else {
|
|
56 pad.right = 0;
|
|
57 }
|
|
58 if (pad1 & SJOY_PS2_UP) {
|
|
59 pad.up += (pad.up > 100) ? 0 : 1;
|
|
60 } else {
|
|
61 pad.up = 0;
|
|
62 }
|
|
63 if (pad1 & SJOY_PS2_DOWN) {
|
|
64 pad.down += (pad.down > 100) ? 0 : 1;
|
|
65 } else {
|
|
66 pad.down = 0;
|
|
67 }
|
|
68 if (pad1 & SJOY_PS2_R1) {
|
|
69 pad.r1 += (pad.r1 > 100) ? 0 : 1;
|
|
70 } else {
|
|
71 pad.r1 = 0;
|
|
72 }
|
|
73 if (pad1 & SJOY_PS2_R2) {
|
|
74 pad.r2 += (pad.r2 > 100) ? 0 : 1;
|
|
75 } else {
|
|
76 pad.r2 = 0;
|
|
77 }
|
|
78 if (pad1 & SJOY_PS2_L1) {
|
|
79 pad.l1 += (pad.l1 > 100) ? 0 : 1;
|
|
80 } else {
|
|
81 pad.l1 = 0;
|
|
82 }
|
|
83 if (pad1 & SJOY_PS2_L2) {
|
|
84 pad.l2 += (pad.l2 > 100) ? 0 : 1;
|
|
85 } else {
|
|
86 pad.l2 = 0;
|
|
87 }
|
|
88 if (pad1 & SJOY_PS2_CROSS) {
|
|
89 pad.cross += (pad.cross > 100) ? 0 : 1;
|
|
90 } else {
|
|
91 pad.cross = 0;
|
|
92 }
|
|
93 if (pad1 & SJOY_PS2_CIRCLE) {
|
|
94 pad.circle += (pad.circle > 100) ? 0 : 1;
|
|
95 } else {
|
|
96 pad.circle = 0;
|
|
97 }
|
|
98 if (pad1 & SJOY_PS2_TRIANGLE) {
|
|
99 pad.triangle += (pad.triangle > 100) ? 0 : 1;
|
|
100 } else {
|
|
101 pad.triangle = 0;
|
|
102 }
|
|
103 if (pad1 & SJOY_PS2_SQUARE) {
|
|
104 pad.square += (pad.square > 100) ? 0 : 1;
|
|
105 } else {
|
|
106 pad.square = 0;
|
|
107 }
|
|
108
|
|
109 if ( (pad1 & SJOY_PS2_SELECT) && (pad1 & SJOY_PS2_START) &&
|
|
110 (pad1 & SJOY_PS2_L1) && (pad1 & SJOY_PS2_R1) &&
|
|
111 (pad1 & SJOY_PS2_L2) && (pad1 & SJOY_PS2_R2)) {
|
|
112 return FALSE;
|
|
113 }
|
|
114
|
|
115 return TRUE;
|
|
116 }
|