version 1.30 | | version 1.31 |
---|
| | |
/* | | /* |
* static char *rcsid_move_c = | | * static char *rcsid_move_c = |
* "$Id: move.c,v 1.30 2004/03/23 07:52:31 mwedel Exp $"; | | * "$Id: move.c,v 1.31 2004/04/14 07:24:31 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
int move_ob (object *op, int dir, object *originator) | | int move_ob (object *op, int dir, object *originator) |
{ | | { |
int newx = op->x+freearr_x[dir]; | | sint16 newx = op->x+freearr_x[dir]; |
int newy = op->y+freearr_y[dir]; | | sint16 newy = op->y+freearr_y[dir]; |
object *tmp; | | object *tmp; |
| | mapstruct *m; |
| | int mflags; |
| | |
| | m = op->map; |
| | mflags = get_map_flags(m, &m, newx, newy, &newx, &newy); |
| | |
if(op==NULL) { | | if(op==NULL) { |
LOG(llevError,"Trying to move NULL.\n"); | | LOG(llevError,"Trying to move NULL.\n"); |
| | |
/* If the space the player is trying to is out of the map, | | /* If the space the player is trying to is out of the map, |
* bail now - we know it can't work. | | * bail now - we know it can't work. |
*/ | | */ |
if (out_of_map(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir])) return 0; | | if (mflags & P_OUT_OF_MAP) return 0; |
| | |
/* 0.94.2 - we need to set the direction for the new animation code. | | /* 0.94.2 - we need to set the direction for the new animation code. |
* it uses it to figure out face to use - I can't see it | | * it uses it to figure out face to use - I can't see it |
| | |
op->direction = dir; | | op->direction = dir; |
| | |
if(op->will_apply&4) | | if(op->will_apply&4) |
check_earthwalls(op,newx,newy); | | check_earthwalls(op,m, newx,newy); |
if(op->will_apply&8) | | if(op->will_apply&8) |
check_doors(op,newx,newy); | | check_doors(op,m, newx,newy); |
| | |
/* 0.94.1 - I got a stack trace that showed it crash with remove_ob trying | | /* 0.94.1 - I got a stack trace that showed it crash with remove_ob trying |
* to remove a removed object, and this function was the culprit. A possible | | * to remove a removed object, and this function was the culprit. A possible |
| | |
for(tmp = op; tmp != NULL; tmp = tmp->more) | | for(tmp = op; tmp != NULL; tmp = tmp->more) |
tmp->x+=freearr_x[dir], tmp->y+=freearr_y[dir]; | | tmp->x+=freearr_x[dir], tmp->y+=freearr_y[dir]; |
| | |
| | /* insert_ob_in_map will deal with any tiling issues */ |
insert_ob_in_map(op, op->map, originator,0); | | insert_ob_in_map(op, op->map, originator,0); |
| | |
/* Hmmm. Should be possible for multispace players now */ | | /* Hmmm. Should be possible for multispace players now */ |