version 1.32 | | version 1.33 |
---|
| | |
/* | | /* |
* static char *rcsid_skills_c = | | * static char *rcsid_skills_c = |
* "$Id: skills.c,v 1.32 2002/12/03 07:40:18 mwedel Exp $"; | | * "$Id: skills.c,v 1.33 2003/01/08 08:39:21 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
int steal(object* op, int dir) | | int steal(object* op, int dir) |
{ | | { |
object *tmp, *next; | | object *tmp, *next; |
int x = op->x + freearr_x[dir]; | | sint16 x, y; |
int y = op->y + freearr_y[dir]; | | |
| | x = op->x + freearr_x[dir]; |
| | y = op->y + freearr_y[dir]; |
| | mapstruct *m; |
| | |
if(dir == 0) { | | if(dir == 0) { |
/* Can't steal from ourself! */ | | /* Can't steal from ourself! */ |
return 0; | | return 0; |
} | | } |
| | |
if(wall(op->map,x,y)) { | | m = op->map; |
| | if(get_map_flags(m, &m ,x,y, &x, &y) & (P_WALL | P_OUT_OF_MAP)) { |
return 0; | | return 0; |
} | | } |
| | |
/* Find the topmost object at this spot */ | | /* Find the topmost object at this spot */ |
for(tmp = get_map_ob(op->map,x,y); | | for(tmp = get_map_ob(m,x,y); |
tmp != NULL && tmp->above != NULL; | | tmp != NULL && tmp->above != NULL; |
tmp = tmp->above); | | tmp = tmp->above); |
| | |
| | |
| | |
CLEAR_FLAG(pl,FLAG_FLYING); | | CLEAR_FLAG(pl,FLAG_FLYING); |
insert_ob_in_map(pl,pl->map,pl,0); | | insert_ob_in_map(pl,pl->map,pl,0); |
if (pl->type==PLAYER) draw(pl); | | |
| | |
/* pl->speed_left= (int) -FABS((load*8)+1); */ | | |
return 0; | | return 0; |
} | | } |
| | |
| | |
static int attempt_jump (object *pl, int dir, int spaces) { | | static int attempt_jump (object *pl, int dir, int spaces) { |
object *tmp; | | object *tmp; |
int i,exp=0,dx=freearr_x[dir],dy=freearr_y[dir]; | | int i,exp=0,dx=freearr_x[dir],dy=freearr_y[dir], mflags; |
| | sint16 x, y; |
| | mapstruct *m; |
| | |
/* Jump loop. Go through spaces opject wants to jump. Halt the | | /* Jump loop. Go through spaces opject wants to jump. Halt the |
* jump if a wall or creature is in the way. We set FLAG_FLYING | | * jump if a wall or creature is in the way. We set FLAG_FLYING |
| | |
remove_ob(pl); | | remove_ob(pl); |
SET_FLAG(pl,FLAG_FLYING); | | SET_FLAG(pl,FLAG_FLYING); |
for(i=0;i<=spaces;i++) { | | for(i=0;i<=spaces;i++) { |
if (out_of_map(pl->map,pl->x+dx,pl->y+dy)) { | | x = pl->x + dx; |
| | y = pl->y + dy; |
| | m = pl->map; |
| | |
| | mflags = get_map_flags(m, &m, x, y, &x, &y); |
| | |
| | |
| | if (mflags & P_OUT_OF_MAP) { |
(void) stop_jump(pl,i,spaces); | | (void) stop_jump(pl,i,spaces); |
return calc_skill_exp(pl,NULL); | | return 0; |
} | | } |
for(tmp=get_map_ob(pl->map,pl->x+dx,pl->y+dy); tmp;tmp=tmp->above) { | | if (mflags & P_WALL) { |
if(wall(tmp->map,tmp->x,tmp->y)) { /* Jump into wall*/ | | |
new_draw_info(NDI_UNIQUE, 0,pl,"Your jump is blocked."); | | new_draw_info(NDI_UNIQUE, 0,pl,"Your jump is blocked."); |
(void) stop_jump(pl,i,spaces); | | (void) stop_jump(pl,i,spaces); |
return 0; | | return 0; |
} | | } |
| | |
| | for(tmp=get_map_ob(m, x, y); tmp;tmp=tmp->above) { |
/* Jump into creature */ | | /* Jump into creature */ |
if(QUERY_FLAG(tmp,FLAG_MONSTER) || tmp->type==PLAYER ) { | | if(QUERY_FLAG(tmp,FLAG_MONSTER) || tmp->type==PLAYER ) { |
new_draw_info_format(NDI_UNIQUE, 0,pl,"You jump into%s%s.", | | new_draw_info_format(NDI_UNIQUE, 0,pl,"You jump into%s%s.", |
| | |
* effectively flying. | | * effectively flying. |
*/ | | */ |
if(QUERY_FLAG(tmp, FLAG_FLY_ON)) { | | if(QUERY_FLAG(tmp, FLAG_FLY_ON)) { |
pl->x+=dx,pl->y+=dy; | | pl->x = x; |
| | pl->y = y; |
| | pl->map = m; |
(void) stop_jump(pl,i,spaces); | | (void) stop_jump(pl,i,spaces); |
return calc_skill_exp(pl,NULL); | | return calc_skill_exp(pl,NULL); |
} | | } |
} | | } |
pl->x+=dx; | | pl->x = x; |
pl->y+=dy; | | pl->y = y; |
| | pl->map = m; |
} | | } |
(void) stop_jump(pl,i,spaces); | | (void) stop_jump(pl,i,spaces); |
return calc_skill_exp(pl,NULL); | | return calc_skill_exp(pl,NULL); |
| | |
* have no effective throwing strength, or you threw at a wall | | * have no effective throwing strength, or you threw at a wall |
*/ | | */ |
if(!dir || (eff_str <= 1) || | | if(!dir || (eff_str <= 1) || |
wall(part->map,part->x+freearr_x[dir],part->y+freearr_y[dir])) { | | get_map_flags(part->map,NULL, |
| | part->x+freearr_x[dir],part->y+freearr_y[dir],NULL,NULL) & (P_WALL | P_OUT_OF_MAP)) { |
| | |
/* bounces off 'wall', and drops to feet */ | | /* bounces off 'wall', and drops to feet */ |
remove_ob(throw_ob); | | remove_ob(throw_ob); |