1 | /* |
1 | /* |
2 | * static char *rcsid_move_c = |
2 | * static char *rcsid_move_c = |
3 | * "$Id: move.C,v 1.1 2006/08/13 17:16:04 elmex Exp $"; |
3 | * "$Id: move.C,v 1.2 2006/08/17 20:23:31 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
137 | |
137 | |
138 | /* insert_ob_in_map will deal with any tiling issues */ |
138 | /* insert_ob_in_map will deal with any tiling issues */ |
139 | insert_ob_in_map(op, m, originator,0); |
139 | insert_ob_in_map(op, m, originator,0); |
140 | |
140 | |
141 | /* Hmmm. Should be possible for multispace players now */ |
141 | /* Hmmm. Should be possible for multispace players now */ |
142 | if (op->type==PLAYER) { |
|
|
143 | esrv_map_scroll(&op->contr->socket, freearr_x[dir],freearr_y[dir]); |
|
|
144 | op->contr->socket.update_look=1; |
|
|
145 | op->contr->socket.look_position=0; |
|
|
146 | } |
|
|
147 | else if (op->type == TRANSPORT) { |
142 | if (op->type == TRANSPORT) { |
148 | object *pl; |
143 | object *pl; |
149 | |
144 | |
150 | for (pl=op->inv; pl; pl=pl->below) { |
145 | for (pl=op->inv; pl; pl=pl->below) { |
151 | if (pl->type == PLAYER) { |
146 | if (pl->type == PLAYER) { |
152 | pl->contr->do_los=1; |
147 | pl->contr->do_los=1; |
153 | pl->map = op->map; |
148 | pl->map = op->map; |
154 | pl->x = op->x; |
149 | pl->x = op->x; |
155 | pl->y = op->y; |
150 | pl->y = op->y; |
156 | esrv_map_scroll(&pl->contr->socket, freearr_x[dir],freearr_y[dir]); |
|
|
157 | pl->contr->socket.update_look=1; |
|
|
158 | pl->contr->socket.look_position=0; |
|
|
159 | } |
151 | } |
160 | } |
152 | } |
161 | } |
153 | } |
162 | |
154 | |
163 | return 1; /* this shouldn't be reached */ |
155 | return 1; /* this shouldn't be reached */ |
… | |
… | |
195 | for(tmp=op;tmp!=NULL;tmp=tmp->more) |
187 | for(tmp=op;tmp!=NULL;tmp=tmp->more) |
196 | tmp->x=x+freearr_x[i]+(tmp->arch==NULL?0:tmp->arch->clone.x), |
188 | tmp->x=x+freearr_x[i]+(tmp->arch==NULL?0:tmp->arch->clone.x), |
197 | tmp->y=y+freearr_y[i]+(tmp->arch==NULL?0:tmp->arch->clone.y); |
189 | tmp->y=y+freearr_y[i]+(tmp->arch==NULL?0:tmp->arch->clone.y); |
198 | |
190 | |
199 | tmp = insert_ob_in_map(op,op->map,originator,0); |
191 | tmp = insert_ob_in_map(op,op->map,originator,0); |
200 | if (op && op->type == PLAYER) MapNewmapCmd(op->contr); |
|
|
201 | if (tmp) return 0; |
192 | if (tmp) return 0; |
202 | else return 1; |
193 | else return 1; |
203 | } |
194 | } |
204 | |
195 | |
205 | /* |
196 | /* |
… | |
… | |
292 | (tmp->arch==NULL?0:tmp->arch->clone.x); |
283 | (tmp->arch==NULL?0:tmp->arch->clone.x); |
293 | tmp->y=other_teleporter->y+freearr_y[k]+ |
284 | tmp->y=other_teleporter->y+freearr_y[k]+ |
294 | (tmp->arch==NULL?0:tmp->arch->clone.y); |
285 | (tmp->arch==NULL?0:tmp->arch->clone.y); |
295 | } |
286 | } |
296 | tmp = insert_ob_in_map(user,other_teleporter->map,NULL,0); |
287 | tmp = insert_ob_in_map(user,other_teleporter->map,NULL,0); |
297 | if (tmp && tmp->type == PLAYER) MapNewmapCmd(tmp->contr); |
|
|
298 | return (tmp == NULL); |
288 | return (tmp == NULL); |
299 | } |
289 | } |
300 | |
290 | |
301 | void recursive_roll(object *op,int dir,object *pusher) { |
291 | void recursive_roll(object *op,int dir,object *pusher) { |
302 | if(!roll_ob(op,dir,pusher)) { |
292 | if(!roll_ob(op,dir,pusher)) { |
… | |
… | |
446 | pusher->map = who->map; |
436 | pusher->map = who->map; |
447 | who->map = m; |
437 | who->map = m; |
448 | |
438 | |
449 | insert_ob_in_map (who,who->map,pusher,0); |
439 | insert_ob_in_map (who,who->map,pusher,0); |
450 | insert_ob_in_map (pusher,pusher->map,pusher,0); |
440 | insert_ob_in_map (pusher,pusher->map,pusher,0); |
451 | |
|
|
452 | /* we presume that if the player is pushing his put, he moved in |
|
|
453 | * direction 'dir'. I can' think of any case where this would not be |
|
|
454 | * the case. Putting the map_scroll should also improve performance some. |
|
|
455 | */ |
|
|
456 | if (pusher->type == PLAYER ) { |
|
|
457 | esrv_map_scroll(&pusher->contr->socket, freearr_x[dir],freearr_y[dir]); |
|
|
458 | pusher->contr->socket.update_look=1; |
|
|
459 | pusher->contr->socket.look_position=0; |
|
|
460 | } |
|
|
461 | return 0; |
441 | return 0; |
462 | } |
442 | } |
463 | |
443 | |
464 | |
444 | |
465 | /* We want ONLY become enemy of evil, unaggressive monster. We must RUN in them */ |
445 | /* We want ONLY become enemy of evil, unaggressive monster. We must RUN in them */ |