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