… | |
… | |
50 | * after this function has been called. |
50 | * after this function has been called. |
51 | * (What happened to this function? It no longer copies the pointers! -Frank) |
51 | * (What happened to this function? It no longer copies the pointers! -Frank) |
52 | * moved to Edit.c from common/map.c since Edit.c is the only file that uses it. |
52 | * moved to Edit.c from common/map.c since Edit.c is the only file that uses it. |
53 | */ |
53 | */ |
54 | |
54 | |
55 | static void copy_map(mapstruct *m1, mapstruct *m2) { |
55 | void copy_map(mapstruct *m1, mapstruct *m2) { |
56 | int x,y; |
56 | int x,y; |
57 | |
57 | |
58 | memcpy(m2, m1, sizeof(mapstruct)); |
58 | memcpy(m2, m1, sizeof(mapstruct)); |
59 | |
59 | |
60 | for(x=0;x<MAP_WIDTH(m1)&&x<MAP_WIDTH(m2);x++) |
60 | for(x=0;x<MAP_WIDTH(m1)&&x<MAP_WIDTH(m2);x++) |
… | |
… | |
71 | * width : width of target map |
71 | * width : width of target map |
72 | * height: height of target map |
72 | * height: height of target map |
73 | * dx : positive translate to right |
73 | * dx : positive translate to right |
74 | * dy : positive translate to down |
74 | * dy : positive translate to down |
75 | */ |
75 | */ |
76 | static mapstruct *MapMoveScrollResize(mapstruct *source, |
76 | mapstruct *MapMoveScrollResize(mapstruct *source, |
77 | int width, int height, int dx, int dy) |
77 | int width, int height, int dx, int dy) |
78 | { |
78 | { |
79 | mapstruct *target; |
79 | mapstruct *target; |
80 | object *obj,*prt; /* PaRT of obj */ |
80 | object *obj,*prt; /* PaRT of obj */ |
81 | int x,y,sx = MAP_WIDTH(source), sy = MAP_HEIGHT(source); |
81 | int x,y,sx = MAP_WIDTH(source), sy = MAP_HEIGHT(source); |
… | |
… | |
160 | delete_map (source); |
160 | delete_map (source); |
161 | return target; |
161 | return target; |
162 | } |
162 | } |
163 | |
163 | |
164 | |
164 | |
165 | static object * MapGetRealObject (mapstruct * emap, int x, int y, int z) |
165 | object * MapGetRealObject (mapstruct * emap, int x, int y, int z) |
166 | { |
166 | { |
167 | object *tmp = MapGetObjectZ (emap, x, y, z); |
167 | object *tmp = MapGetObjectZ (emap, x, y, z); |
168 | return tmp ? (tmp->head ? tmp->head : tmp) : tmp; |
168 | return tmp ? (tmp->head ? tmp->head : tmp) : tmp; |
169 | } |
169 | } |
170 | |
170 | |
171 | static int MapInsertObjectZ(mapstruct *emap,object *o,int x, int y, int z) |
171 | int MapInsertObjectZ(mapstruct *emap,object *o,int x, int y, int z) |
172 | { |
172 | { |
173 | object *op, *above, *below; |
173 | object *op, *above, *below; |
174 | |
174 | |
175 | if (o->more) |
175 | if (o->more) |
176 | MapInsertObjectZ (emap,o->more, x, y, z); |
176 | MapInsertObjectZ (emap,o->more, x, y, z); |
… | |
… | |
209 | set_map_ob (emap, o->x, o->y, o); |
209 | set_map_ob (emap, o->x, o->y, o); |
210 | |
210 | |
211 | return (0); |
211 | return (0); |
212 | } |
212 | } |
213 | |
213 | |
214 | static int MapObjectOut (mapstruct *target, object *obj, int x, int y) { |
214 | int MapObjectOut (mapstruct *target, object *obj, int x, int y) { |
215 | object *tmp; |
215 | object *tmp; |
216 | for(tmp = obj; tmp; tmp = tmp->more) |
216 | for(tmp = obj; tmp; tmp = tmp->more) |
217 | if(OUT_OF_REAL_MAP(target,x + tmp->x,y + tmp->y)) return 1; |
217 | if(OUT_OF_REAL_MAP(target,x + tmp->x,y + tmp->y)) return 1; |
218 | return 0; |
218 | return 0; |
219 | } |
219 | } |