1 |
root |
1.1 |
/* |
2 |
|
|
* static char *rcsid_c_move_c = |
3 |
|
|
* "$Id: c_move.c,v 1.6 2003/09/13 05:02:08 mwedel Exp $"; |
4 |
|
|
*/ |
5 |
|
|
|
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> |
30 |
|
|
#ifndef __CEXTRACT__ |
31 |
|
|
#include <sproto.h> |
32 |
|
|
#endif |
33 |
|
|
#include <skills.h> |
34 |
|
|
|
35 |
|
|
static int move_internal (object *op, char *params, int dir) |
36 |
|
|
{ |
37 |
|
|
if (params) { |
38 |
|
|
if (params[0] == 'f') { |
39 |
|
|
if (!op->contr->fire_on) { |
40 |
|
|
op->contr->fire_on =1; |
41 |
|
|
move_player(op, dir); |
42 |
|
|
op->contr->fire_on =0; |
43 |
|
|
return 0; |
44 |
|
|
} |
45 |
|
|
} else if (params[0] == 'r' && !op->contr->run_on) |
46 |
|
|
op->contr->run_on =1; |
47 |
|
|
} |
48 |
|
|
move_player(op, dir); |
49 |
|
|
return 0; |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
int command_east (object *op, char *params) |
53 |
|
|
{ |
54 |
|
|
return move_internal(op, params, 3); |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
int command_north (object *op, char *params) |
58 |
|
|
{ |
59 |
|
|
return move_internal(op, params, 1); |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
int command_northeast (object *op, char *params) |
63 |
|
|
{ |
64 |
|
|
return move_internal(op, params, 2); |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
int command_northwest (object *op, char *params) |
68 |
|
|
{ |
69 |
|
|
return move_internal(op, params, 8); |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
int command_south (object *op, char *params) |
73 |
|
|
{ |
74 |
|
|
return move_internal(op, params, 5); |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
int command_southeast (object *op, char *params) |
78 |
|
|
{ |
79 |
|
|
return move_internal(op, params, 4); |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
int command_southwest (object *op, char *params) |
83 |
|
|
{ |
84 |
|
|
return move_internal(op, params, 6); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
int command_west (object *op, char *params) |
88 |
|
|
{ |
89 |
|
|
return move_internal(op, params, 7); |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
int command_stay (object *op, char *params) |
93 |
|
|
{ |
94 |
|
|
if (!op->contr->fire_on && (!params || params[0] != 'f')) |
95 |
|
|
return 0; |
96 |
|
|
fire(op, 0); |
97 |
|
|
return 0; |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
|