]> icculus.org git repositories - crow/jumpnbump.git/blob - sdl/input.c
Added -noflies option (doesn't affect butterflies).
[crow/jumpnbump.git] / sdl / input.c
1 /*
2  * input.c
3  * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
4  * 
5  * Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
6  *
7  * Copyright (C) 2002 Florian Schulze <crow@icculus.org>
8  *
9  * Portions of this code are from the MPEG software simulation group
10  * idct implementation. This code will be replaced with a new
11  * implementation soon.
12  *
13  * This file is part of Jump'n'Bump.
14  *
15  * Jump'n'Bump is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2 of the License, or
18  * (at your option) any later version.
19  *
20  * Jump'n'Bump is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28  */
29
30 #include "globals.h"
31
32 int calib_joy(int type)
33 {
34         return 1;
35 }
36
37 void update_player_actions(void)
38 {
39         int tmp;
40
41         if (client_player_num < 0) {
42                 tmp = (key_pressed(KEY_PL1_LEFT) == 1);
43                 if (tmp != player[0].action_left)
44                         tellServerPlayerMoved(0, MOVEMENT_LEFT, tmp);
45                 tmp = (key_pressed(KEY_PL1_RIGHT) == 1);
46                 if (tmp != player[0].action_right)
47                         tellServerPlayerMoved(0, MOVEMENT_RIGHT, tmp);
48                 tmp = (key_pressed(KEY_PL1_JUMP) == 1);
49                 if (tmp != player[0].action_up)
50                         tellServerPlayerMoved(0, MOVEMENT_UP, tmp);
51
52                 tmp = (key_pressed(KEY_PL2_LEFT) == 1);
53                 if (tmp != player[1].action_left)
54                         tellServerPlayerMoved(1, MOVEMENT_LEFT, tmp);
55                 tmp = (key_pressed(KEY_PL2_RIGHT) == 1);
56                 if (tmp != player[1].action_right)
57                         tellServerPlayerMoved(1, MOVEMENT_RIGHT, tmp);
58                 tmp = (key_pressed(KEY_PL2_JUMP) == 1);
59                 if (tmp != player[1].action_up)
60                         tellServerPlayerMoved(1, MOVEMENT_UP, tmp);
61
62                 tmp = (key_pressed(KEY_PL3_LEFT) == 1);
63                 if (tmp != player[2].action_left)
64                         tellServerPlayerMoved(2, MOVEMENT_LEFT, tmp);
65                 tmp = (key_pressed(KEY_PL3_RIGHT) == 1);
66                 if (tmp != player[2].action_right)
67                         tellServerPlayerMoved(2, MOVEMENT_RIGHT, tmp);
68                 tmp = (key_pressed(KEY_PL3_JUMP) == 1);
69                 if (tmp != player[2].action_up)
70                         tellServerPlayerMoved(2, MOVEMENT_UP, tmp);
71
72                 tmp = (key_pressed(KEY_PL4_LEFT) == 1);
73                 if (tmp != player[3].action_left)
74                 tellServerPlayerMoved(3, MOVEMENT_LEFT, tmp);
75                 tmp = (key_pressed(KEY_PL4_RIGHT) == 1);
76                 if (tmp != player[3].action_right)
77                 tellServerPlayerMoved(3, MOVEMENT_RIGHT, tmp);
78                 tmp = (key_pressed(KEY_PL4_JUMP) == 1);
79                 if (tmp != player[3].action_up)
80                 tellServerPlayerMoved(3, MOVEMENT_UP, tmp);
81         } else {
82                 tmp = (key_pressed(KEY_PL1_LEFT) == 1);
83                 if (tmp != player[client_player_num].action_left)
84                         tellServerPlayerMoved(client_player_num, MOVEMENT_LEFT, tmp);
85                 tmp = (key_pressed(KEY_PL1_RIGHT) == 1);
86                 if (tmp != player[client_player_num].action_right)
87                         tellServerPlayerMoved(client_player_num, MOVEMENT_RIGHT, tmp);
88                 tmp = (key_pressed(KEY_PL1_JUMP) == 1);
89                 if (tmp != player[client_player_num].action_up)
90                         tellServerPlayerMoved(client_player_num, MOVEMENT_UP, tmp);
91         }
92 }
93
94 void init_inputs(void)
95 {
96         main_info.mouse_enabled = 0;
97         main_info.joy_enabled = 0;
98 }