1 |
elmex |
1.1 |
/* |
2 |
|
|
CrossFire, A Multiplayer game for X-windows |
3 |
|
|
|
4 |
|
|
Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 |
|
|
Copyright (C) 1992 Frank Tore Johansen |
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or modify |
8 |
|
|
it under the terms of the GNU General Public License as published by |
9 |
|
|
the Free Software Foundation; either version 2 of the License, or |
10 |
|
|
(at your option) any later version. |
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful, |
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
GNU General Public License for more details. |
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License |
18 |
|
|
along with this program; if not, write to the Free Software |
19 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 |
|
|
|
21 |
root |
1.4 |
The author can be reached via e-mail to <crossfire@schmorp.de> |
22 |
elmex |
1.1 |
*/ |
23 |
|
|
|
24 |
|
|
#include <global.h> |
25 |
root |
1.5 |
#include <sproto.h> |
26 |
elmex |
1.1 |
#include <skills.h> |
27 |
|
|
|
28 |
root |
1.3 |
static int |
29 |
|
|
move_internal (object *op, char *params, int dir) |
30 |
elmex |
1.1 |
{ |
31 |
root |
1.3 |
if (params) |
32 |
|
|
{ |
33 |
|
|
if (params[0] == 'f') |
34 |
|
|
{ |
35 |
|
|
if (!op->contr->fire_on) |
36 |
|
|
{ |
37 |
|
|
op->contr->fire_on = 1; |
38 |
|
|
move_player (op, dir); |
39 |
|
|
op->contr->fire_on = 0; |
40 |
|
|
return 0; |
41 |
|
|
} |
42 |
|
|
} |
43 |
|
|
else if (params[0] == 'r' && !op->contr->run_on) |
44 |
|
|
op->contr->run_on = 1; |
45 |
|
|
} |
46 |
|
|
move_player (op, dir); |
47 |
elmex |
1.1 |
return 0; |
48 |
|
|
} |
49 |
|
|
|
50 |
root |
1.3 |
int |
51 |
|
|
command_east (object *op, char *params) |
52 |
elmex |
1.1 |
{ |
53 |
root |
1.3 |
return move_internal (op, params, 3); |
54 |
elmex |
1.1 |
} |
55 |
|
|
|
56 |
root |
1.3 |
int |
57 |
|
|
command_north (object *op, char *params) |
58 |
elmex |
1.1 |
{ |
59 |
root |
1.3 |
return move_internal (op, params, 1); |
60 |
elmex |
1.1 |
} |
61 |
|
|
|
62 |
root |
1.3 |
int |
63 |
|
|
command_northeast (object *op, char *params) |
64 |
elmex |
1.1 |
{ |
65 |
root |
1.3 |
return move_internal (op, params, 2); |
66 |
elmex |
1.1 |
} |
67 |
|
|
|
68 |
root |
1.3 |
int |
69 |
|
|
command_northwest (object *op, char *params) |
70 |
elmex |
1.1 |
{ |
71 |
root |
1.3 |
return move_internal (op, params, 8); |
72 |
elmex |
1.1 |
} |
73 |
|
|
|
74 |
root |
1.3 |
int |
75 |
|
|
command_south (object *op, char *params) |
76 |
elmex |
1.1 |
{ |
77 |
root |
1.3 |
return move_internal (op, params, 5); |
78 |
elmex |
1.1 |
} |
79 |
|
|
|
80 |
root |
1.3 |
int |
81 |
|
|
command_southeast (object *op, char *params) |
82 |
elmex |
1.1 |
{ |
83 |
root |
1.3 |
return move_internal (op, params, 4); |
84 |
elmex |
1.1 |
} |
85 |
|
|
|
86 |
root |
1.3 |
int |
87 |
|
|
command_southwest (object *op, char *params) |
88 |
elmex |
1.1 |
{ |
89 |
root |
1.3 |
return move_internal (op, params, 6); |
90 |
elmex |
1.1 |
} |
91 |
|
|
|
92 |
root |
1.3 |
int |
93 |
|
|
command_west (object *op, char *params) |
94 |
elmex |
1.1 |
{ |
95 |
root |
1.3 |
return move_internal (op, params, 7); |
96 |
elmex |
1.1 |
} |
97 |
|
|
|
98 |
root |
1.3 |
int |
99 |
|
|
command_stay (object *op, char *params) |
100 |
elmex |
1.1 |
{ |
101 |
|
|
if (!op->contr->fire_on && (!params || params[0] != 'f')) |
102 |
|
|
return 0; |
103 |
root |
1.3 |
fire (op, 0); |
104 |
elmex |
1.1 |
return 0; |
105 |
|
|
} |