|
|
1 | |
1 | /* |
2 | /* |
2 | * static char *rcsid_c_move_c = |
3 | * static char *rcsid_c_move_c = |
3 | * "$Id: c_move.C,v 1.2 2006/08/29 08:01:37 root Exp $"; |
4 | * "$Id: c_move.C,v 1.3 2006/09/10 15:59:57 root Exp $"; |
4 | */ |
5 | */ |
5 | |
6 | |
6 | /* |
7 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
8 | |
9 | |
… | |
… | |
26 | The author can be reached via e-mail to crossfire-devel@real-time.com |
27 | The author can be reached via e-mail to crossfire-devel@real-time.com |
27 | */ |
28 | */ |
28 | |
29 | |
29 | #include <global.h> |
30 | #include <global.h> |
30 | #ifndef __CEXTRACT__ |
31 | #ifndef __CEXTRACT__ |
31 | #include <sproto.h> |
32 | # include <sproto.h> |
32 | #endif |
33 | #endif |
33 | #include <skills.h> |
34 | #include <skills.h> |
34 | |
35 | |
|
|
36 | static int |
35 | static int move_internal (object *op, char *params, int dir) |
37 | move_internal (object *op, char *params, int dir) |
36 | { |
38 | { |
37 | if (params) { |
39 | if (params) |
|
|
40 | { |
38 | if (params[0] == 'f') { |
41 | if (params[0] == 'f') |
|
|
42 | { |
39 | if (!op->contr->fire_on) { |
43 | if (!op->contr->fire_on) |
|
|
44 | { |
40 | op->contr->fire_on =1; |
45 | op->contr->fire_on = 1; |
41 | move_player(op, dir); |
46 | move_player (op, dir); |
42 | op->contr->fire_on =0; |
47 | op->contr->fire_on = 0; |
43 | return 0; |
48 | return 0; |
|
|
49 | } |
44 | } |
50 | } |
45 | } else if (params[0] == 'r' && !op->contr->run_on) |
51 | else if (params[0] == 'r' && !op->contr->run_on) |
46 | op->contr->run_on =1; |
52 | op->contr->run_on = 1; |
47 | } |
53 | } |
48 | move_player(op, dir); |
54 | move_player (op, dir); |
49 | return 0; |
55 | return 0; |
50 | } |
56 | } |
51 | |
57 | |
|
|
58 | int |
52 | int command_east (object *op, char *params) |
59 | command_east (object *op, char *params) |
53 | { |
60 | { |
54 | return move_internal(op, params, 3); |
61 | return move_internal (op, params, 3); |
55 | } |
62 | } |
56 | |
63 | |
|
|
64 | int |
57 | int command_north (object *op, char *params) |
65 | command_north (object *op, char *params) |
58 | { |
66 | { |
59 | return move_internal(op, params, 1); |
67 | return move_internal (op, params, 1); |
60 | } |
68 | } |
61 | |
69 | |
|
|
70 | int |
62 | int command_northeast (object *op, char *params) |
71 | command_northeast (object *op, char *params) |
63 | { |
72 | { |
64 | return move_internal(op, params, 2); |
73 | return move_internal (op, params, 2); |
65 | } |
74 | } |
66 | |
75 | |
|
|
76 | int |
67 | int command_northwest (object *op, char *params) |
77 | command_northwest (object *op, char *params) |
68 | { |
78 | { |
69 | return move_internal(op, params, 8); |
79 | return move_internal (op, params, 8); |
70 | } |
80 | } |
71 | |
81 | |
|
|
82 | int |
72 | int command_south (object *op, char *params) |
83 | command_south (object *op, char *params) |
73 | { |
84 | { |
74 | return move_internal(op, params, 5); |
85 | return move_internal (op, params, 5); |
75 | } |
86 | } |
76 | |
87 | |
|
|
88 | int |
77 | int command_southeast (object *op, char *params) |
89 | command_southeast (object *op, char *params) |
78 | { |
90 | { |
79 | return move_internal(op, params, 4); |
91 | return move_internal (op, params, 4); |
80 | } |
92 | } |
81 | |
93 | |
|
|
94 | int |
82 | int command_southwest (object *op, char *params) |
95 | command_southwest (object *op, char *params) |
83 | { |
96 | { |
84 | return move_internal(op, params, 6); |
97 | return move_internal (op, params, 6); |
85 | } |
98 | } |
86 | |
99 | |
|
|
100 | int |
87 | int command_west (object *op, char *params) |
101 | command_west (object *op, char *params) |
88 | { |
102 | { |
89 | return move_internal(op, params, 7); |
103 | return move_internal (op, params, 7); |
90 | } |
104 | } |
91 | |
105 | |
|
|
106 | int |
92 | int command_stay (object *op, char *params) |
107 | command_stay (object *op, char *params) |
93 | { |
108 | { |
94 | if (!op->contr->fire_on && (!params || params[0] != 'f')) |
109 | if (!op->contr->fire_on && (!params || params[0] != 'f')) |
95 | return 0; |
110 | return 0; |
96 | fire(op, 0); |
111 | fire (op, 0); |
97 | return 0; |
112 | return 0; |
98 | } |
113 | } |
99 | |
|
|
100 | |
|
|