1 |
elmex |
1.1 |
/* |
2 |
root |
1.12 |
* This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 |
pippijn |
1.7 |
* |
4 |
root |
1.12 |
* Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 |
root |
1.10 |
* Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 |
|
|
* Copyright (©) 1992,2007 Frank Tore Johansen |
7 |
pippijn |
1.7 |
* |
8 |
root |
1.12 |
* Deliantra is free software: you can redistribute it and/or modify |
9 |
root |
1.11 |
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation, either version 3 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
pippijn |
1.7 |
* |
13 |
root |
1.11 |
* 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 |
pippijn |
1.7 |
* |
18 |
root |
1.11 |
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
root |
1.10 |
* |
21 |
root |
1.12 |
* The authors can be reached via e-mail to <support@deliantra.net> |
22 |
pippijn |
1.7 |
*/ |
23 |
elmex |
1.1 |
|
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 |
root |
1.9 |
|
47 |
root |
1.3 |
move_player (op, dir); |
48 |
elmex |
1.1 |
return 0; |
49 |
|
|
} |
50 |
|
|
|
51 |
root |
1.3 |
int |
52 |
|
|
command_east (object *op, char *params) |
53 |
elmex |
1.1 |
{ |
54 |
root |
1.3 |
return move_internal (op, params, 3); |
55 |
elmex |
1.1 |
} |
56 |
|
|
|
57 |
root |
1.3 |
int |
58 |
|
|
command_north (object *op, char *params) |
59 |
elmex |
1.1 |
{ |
60 |
root |
1.3 |
return move_internal (op, params, 1); |
61 |
elmex |
1.1 |
} |
62 |
|
|
|
63 |
root |
1.3 |
int |
64 |
|
|
command_northeast (object *op, char *params) |
65 |
elmex |
1.1 |
{ |
66 |
root |
1.3 |
return move_internal (op, params, 2); |
67 |
elmex |
1.1 |
} |
68 |
|
|
|
69 |
root |
1.3 |
int |
70 |
|
|
command_northwest (object *op, char *params) |
71 |
elmex |
1.1 |
{ |
72 |
root |
1.3 |
return move_internal (op, params, 8); |
73 |
elmex |
1.1 |
} |
74 |
|
|
|
75 |
root |
1.3 |
int |
76 |
|
|
command_south (object *op, char *params) |
77 |
elmex |
1.1 |
{ |
78 |
root |
1.3 |
return move_internal (op, params, 5); |
79 |
elmex |
1.1 |
} |
80 |
|
|
|
81 |
root |
1.3 |
int |
82 |
|
|
command_southeast (object *op, char *params) |
83 |
elmex |
1.1 |
{ |
84 |
root |
1.3 |
return move_internal (op, params, 4); |
85 |
elmex |
1.1 |
} |
86 |
|
|
|
87 |
root |
1.3 |
int |
88 |
|
|
command_southwest (object *op, char *params) |
89 |
elmex |
1.1 |
{ |
90 |
root |
1.3 |
return move_internal (op, params, 6); |
91 |
elmex |
1.1 |
} |
92 |
|
|
|
93 |
root |
1.3 |
int |
94 |
|
|
command_west (object *op, char *params) |
95 |
elmex |
1.1 |
{ |
96 |
root |
1.3 |
return move_internal (op, params, 7); |
97 |
elmex |
1.1 |
} |
98 |
|
|
|
99 |
pippijn |
1.8 |
// XXX: What does this do? |
100 |
root |
1.3 |
int |
101 |
|
|
command_stay (object *op, char *params) |
102 |
elmex |
1.1 |
{ |
103 |
|
|
if (!op->contr->fire_on && (!params || params[0] != 'f')) |
104 |
|
|
return 0; |
105 |
root |
1.3 |
fire (op, 0); |
106 |
elmex |
1.1 |
return 0; |
107 |
|
|
} |