version 1.18 | | version 1.19 |
---|
| | |
/* | | /* |
* static char *rcsid_move_c = | | * static char *rcsid_move_c = |
* "$Id: move.c,v 1.18 2001/11/28 04:44:42 michtoen Exp $"; | | * "$Id: move.c,v 1.19 2002/04/21 05:23:20 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
Copyright (C) 2001 Mark Wedel | | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
Copyright (C) 1992 Frank Tore Johansen | | Copyright (C) 1992 Frank Tore Johansen |
| | |
This program is free software; you can redistribute it and/or modify | | This program is free software; you can redistribute it and/or modify |
| | |
along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| | |
The author can be reached via e-mail to mwedel@scruz.net | | The author can be reached via e-mail to crossfire-devel@real-time.com |
*/ | | */ |
| | |
#include <global.h> | | #include <global.h> |
| | |
who = who->head; | | who = who->head; |
owner = get_owner(who); | | owner = get_owner(who); |
| | |
CLEAR_FLAG(who,FLAG_SLEEP); /* what ever: this action lets wakeup the sucker */ | | /* Wake up sleeping monsters that may be pushed */ |
| | CLEAR_FLAG(who,FLAG_SLEEP); |
| | |
/* player change place with his pets or summoned creature */ | | /* player change place with his pets or summoned creature */ |
/* TODO: allow multi arch pushing. Can't be very difficult */ | | /* TODO: allow multi arch pushing. Can't be very difficult */ |
if (who->more == NULL && owner == pusher) | | if (who->more == NULL && owner == pusher) { |
{ | | |
int temp; | | int temp; |
remove_ob(who); | | remove_ob(who); |
remove_ob(pusher); | | remove_ob(pusher); |
| | |
who->y = temp; | | who->y = temp; |
insert_ob_in_map (who,who->map,pusher,0); | | insert_ob_in_map (who,who->map,pusher,0); |
insert_ob_in_map (pusher,pusher->map,pusher,0); | | insert_ob_in_map (pusher,pusher->map,pusher,0); |
| | |
| | /* we presume that if the player is pushing his put, he moved in |
| | * direction 'dir'. I can' think of any case where this would not be |
| | * the case. Putting the map_scroll should also improve performance some. |
| | */ |
| | if (pusher->type == PLAYER ) { |
| | esrv_map_scroll(&pusher->contr->socket, freearr_x[dir],freearr_y[dir]); |
| | pusher->contr->socket.update_look=1; |
| | pusher->contr->socket.look_position=0; |
| | } |
return 0; | | return 0; |
} | | } |
| | |
| | |
/* In original we have here a unaggressive check only - that was the reason why */ | | /* In original we have here a unaggressive check only - that was the reason why */ |
/* we so often become an enemy of friendly monsters... */ | | /* we so often become an enemy of friendly monsters... */ |
/* funny: was they set to unaggressive 0 (= not so nice) they don't attack */ | | /* funny: was they set to unaggressive 0 (= not so nice) they don't attack */ |
| | |
if(owner != pusher && pusher->type == PLAYER && who->type != PLAYER && | | if(owner != pusher && pusher->type == PLAYER && who->type != PLAYER && |
!QUERY_FLAG(who,FLAG_FRIENDLY)&& !QUERY_FLAG(who,FLAG_NEUTRAL)) | | !QUERY_FLAG(who,FLAG_FRIENDLY)&& !QUERY_FLAG(who,FLAG_NEUTRAL)) { |
{ | | if(pusher->contr->run_on) /* only when we run */ { |
if(pusher->contr->run_on) /* only when we run */ | | |
{ | | |
new_draw_info_format(NDI_UNIQUE, 0, pusher, | | new_draw_info_format(NDI_UNIQUE, 0, pusher, |
"You start to attack %s !!",who->name); | | "You start to attack %s !!",who->name); |
CLEAR_FLAG(who,FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ | | CLEAR_FLAG(who,FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ |
| | |
return 0; | | return 0; |
} | | } |
| | |
/* ok, now we are here. I only allow player pushing */ | | /* This block is basically if you are pushing friendly but |
/* for monsters, we have the arch commands how and why they can move/pushed */ | | * non pet creaturs. |
/* and we have melee power like knockback */ | | * It basically does a random strength comparision to |
| | * determine if you can push someone around. Note that |
| | * this pushes the other person away - its not a swap. |
| | */ |
| | |
str1 = (who->stats.Str>0?who->stats.Str:who->level); | | str1 = (who->stats.Str>0?who->stats.Str:who->level); |
str2 = (pusher->stats.Str>0?pusher->stats.Str:pusher->level); | | str2 = (pusher->stats.Str>0?pusher->stats.Str:pusher->level); |
if(QUERY_FLAG(who,FLAG_WIZ) || | | if(QUERY_FLAG(who,FLAG_WIZ) || |
| | |
new_draw_info_format(NDI_UNIQUE, 0, who, | | new_draw_info_format(NDI_UNIQUE, 0, who, |
"%s tried to push you.",pusher->name); | | "%s tried to push you.",pusher->name); |
} | | } |
| | |
return 0; | | return 0; |
} | | } |
| | |
| | /* If we get here, the push succeeded. Let each now the |
| | * status. I'm not sure if the second statement really needs |
| | * to be in an else block - the message is going to a different |
| | * player |
| | */ |
if (who->type == PLAYER) { | | if (who->type == PLAYER) { |
new_draw_info_format(NDI_UNIQUE, 0, who, | | new_draw_info_format(NDI_UNIQUE, 0, who, |
"%s pushed you.",pusher->name); | | "%s pushed you.",pusher->name); |