version 1.67 | | version 1.68 |
---|
| | |
/* | | /* |
* static char *rcsid_skills_c = | | * static char *rcsid_skills_c = |
* "$Id: skills.c,v 1.67 2005/11/06 12:14:05 akirschbaum Exp $"; | | * "$Id: skills.c,v 1.68 2005/11/16 08:16:09 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
object *tmp, *next; | | object *tmp, *next; |
sint16 x, y; | | sint16 x, y; |
mapstruct *m; | | mapstruct *m; |
| | int mflags; |
| | |
x = op->x + freearr_x[dir]; | | x = op->x + freearr_x[dir]; |
y = op->y + freearr_y[dir]; | | y = op->y + freearr_y[dir]; |
| | |
} | | } |
| | |
m = op->map; | | m = op->map; |
if(get_map_flags(m, &m ,x,y, &x, &y) & (P_WALL | P_OUT_OF_MAP)) { | | mflags = get_map_flags(m, &m ,x,y, &x, &y); |
| | /* Out of map - can't do it. If nothing alive on this space, |
| | * don't need to look any further. |
| | */ |
| | if ((mflags & P_OUT_OF_MAP) || !(mflags & P_IS_ALIVE)) |
| | return 0; |
| | |
| | /* If player can't move onto the space, can't steal from it. */ |
| | if (OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, x, y))) |
return 0; | | return 0; |
} | | |
| | |
/* Find the topmost object at this spot */ | | /* Find the topmost object at this spot */ |
for(tmp = get_map_ob(m,x,y); | | for(tmp = get_map_ob(m,x,y); |
| | |
* the 'head' coz 'tail' objects have no inventory! - b.t. | | * the 'head' coz 'tail' objects have no inventory! - b.t. |
*/ | | */ |
if (tmp->head) tmp=tmp->head; | | if (tmp->head) tmp=tmp->head; |
| | |
if(tmp->type!=PLAYER&&!QUERY_FLAG(tmp, FLAG_MONSTER)) continue; | | if(tmp->type!=PLAYER&&!QUERY_FLAG(tmp, FLAG_MONSTER)) continue; |
| | |
/* do not reveal hidden DMs */ | | /* do not reveal hidden DMs */ |
if (tmp->type == PLAYER && QUERY_FLAG(tmp, FLAG_WIZ) && tmp->contr->hidden) continue; | | if (tmp->type == PLAYER && QUERY_FLAG(tmp, FLAG_WIZ) && tmp->contr->hidden) continue; |
if (attempt_steal(tmp, op, skill)) { | | if (attempt_steal(tmp, op, skill)) { |
| | |
return 0; | | return 0; |
} | | } |
| | |
if (!QUERY_FLAG(tmp, FLAG_NO_PASS)) { | | if (!tmp->move_block) { |
new_draw_info(NDI_UNIQUE, 0,pl,"The door has no lock!"); | | new_draw_info(NDI_UNIQUE, 0,pl,"The door has no lock!"); |
return 0; | | return 0; |
} | | } |
| | |
* of jumping. | | * of jumping. |
*/ | | */ |
static void stop_jump(object *pl, int dist, int spaces) { | | static void stop_jump(object *pl, int dist, int spaces) { |
CLEAR_FLAG(pl,FLAG_FLYING); | | fix_player(pl); |
insert_ob_in_map(pl,pl->map,pl,0); | | insert_ob_in_map(pl,pl->map,pl,0); |
} | | } |
| | |
| | |
*/ | | */ |
| | |
remove_ob(pl); | | remove_ob(pl); |
SET_FLAG(pl,FLAG_FLYING); | | |
| | /* |
| | * I don't think this is actually needed - all the movement |
| | * code is handled in this function, and I don't see anyplace |
| | * that cares about the move_type being flying. |
| | */ |
| | pl->move_type |= MOVE_FLY_LOW; |
| | |
for(i=0;i<=spaces;i++) { | | for(i=0;i<=spaces;i++) { |
x = pl->x + dx; | | x = pl->x + dx; |
y = pl->y + dy; | | y = pl->y + dy; |
| | |
(void) stop_jump(pl,i,spaces); | | (void) stop_jump(pl,i,spaces); |
return 0; | | return 0; |
} | | } |
if (mflags & P_WALL) { | | if (OB_TYPE_MOVE_BLOCK(pl, GET_MAP_MOVE_BLOCK(m, x, y))) { |
new_draw_info(NDI_UNIQUE, 0,pl,"Your jump is blocked."); | | new_draw_info(NDI_UNIQUE, 0,pl,"Your jump is blocked."); |
stop_jump(pl,i,spaces); | | stop_jump(pl,i,spaces); |
return 0; | | return 0; |
| | |
* we should get the effects - after all, the player is | | * we should get the effects - after all, the player is |
* effectively flying. | | * effectively flying. |
*/ | | */ |
if(QUERY_FLAG(tmp, FLAG_FLY_ON)) { | | if (tmp->move_on & MOVE_FLY_LOW) { |
pl->x = x; | | pl->x = x; |
pl->y = y; | | pl->y = y; |
pl->map = m; | | pl->map = m; |
| | |
object *throw_ob=toss_item, *left=NULL; | | object *throw_ob=toss_item, *left=NULL; |
tag_t left_tag; | | tag_t left_tag; |
int eff_str = 0,maxc,str=op->stats.Str,dam=0; | | int eff_str = 0,maxc,str=op->stats.Str,dam=0; |
int pause_f,weight_f=0; | | int pause_f,weight_f=0, mflags; |
float str_factor=1.0,load_factor=1.0,item_factor=1.0; | | float str_factor=1.0,load_factor=1.0,item_factor=1.0; |
| | mapstruct *m; |
| | sint16 sx, sy; |
tag_t tag; | | tag_t tag; |
| | |
if(throw_ob==NULL) { | | if(throw_ob==NULL) { |
| | |
#endif | | #endif |
| | |
/* 3 things here prevent a throw, you aimed at your feet, you | | /* 3 things here prevent a throw, you aimed at your feet, you |
* have no effective throwing strength, or you threw at a wall | | * have no effective throwing strength, or you threw at something |
| | * that flying objects can't get through. |
*/ | | */ |
if(!dir || (eff_str <= 1) || | | mflags = get_map_flags(part->map,&m, part->x+freearr_x[dir],part->y+freearr_y[dir],&sx,&sy); |
get_map_flags(part->map,NULL, | | |
part->x+freearr_x[dir],part->y+freearr_y[dir],NULL,NULL) & (P_WALL | P_OUT_OF_MAP)) { | | if(!dir || (eff_str <= 1) || (mflags & P_OUT_OF_MAP) || |
| | (GET_MAP_MOVE_BLOCK(m, sx, sy) & MOVE_FLY_LOW)) { |
| | |
/* bounces off 'wall', and drops to feet */ | | /* bounces off 'wall', and drops to feet */ |
remove_ob(throw_ob); | | remove_ob(throw_ob); |
| | |
throw_ob->speed_left = 0; | | throw_ob->speed_left = 0; |
throw_ob->map = part->map; | | throw_ob->map = part->map; |
| | |
SET_FLAG(throw_ob, FLAG_FLYING); | | throw_ob->move_type = MOVE_FLY_LOW; |
SET_FLAG(throw_ob, FLAG_FLY_ON); | | throw_ob->move_on = MOVE_FLY_LOW | MOVE_WALK; |
SET_FLAG(throw_ob, FLAG_WALK_ON); | | |
#if 0 | | #if 0 |
/* need to put in a good sound for this */ | | /* need to put in a good sound for this */ |
play_sound_map(op->map, op->x, op->y, SOUND_THROW_OBJ); | | play_sound_map(op->map, op->x, op->y, SOUND_THROW_OBJ); |
| | |
| | |
return do_throw(op,part, throw_ob,dir, skill); | | return do_throw(op,part, throw_ob,dir, skill); |
} | | } |
| | |