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