… | |
… | |
147 | static void |
147 | static void |
148 | check_map_change (player *pl) |
148 | check_map_change (player *pl) |
149 | { |
149 | { |
150 | client &socket = *pl->ns; |
150 | client &socket = *pl->ns; |
151 | object *ob = pl->observe; |
151 | object *ob = pl->observe; |
|
|
152 | |
|
|
153 | // first try to aovid a full newmap on tiled map scrolls |
|
|
154 | if (socket.current_map != ob->map) |
|
|
155 | { |
|
|
156 | rv_vector rv; |
|
|
157 | |
|
|
158 | get_rangevector_from_mapcoord (socket.current_map, socket.current_x, socket.current_y, ob, &rv, 0); |
|
|
159 | |
|
|
160 | // manhattan distance is very handy here |
|
|
161 | if (rv.distance < 8) // 8 works nicely for speed << 70 and buggy gcfclient |
|
|
162 | { |
|
|
163 | socket.current_map = ob->map; |
|
|
164 | socket.current_x = ob->x; |
|
|
165 | socket.current_y = ob->y; |
|
|
166 | |
|
|
167 | socket_map_scroll (&socket, rv.distance_x, rv.distance_y); |
|
|
168 | socket.floorbox_reset (); |
|
|
169 | } |
|
|
170 | } |
152 | |
171 | |
153 | if (socket.current_map != ob->map || socket.force_newmap) |
172 | if (socket.current_map != ob->map || socket.force_newmap) |
154 | { |
173 | { |
155 | clear_map (pl); |
174 | clear_map (pl); |
156 | socket.current_map = ob->map; |
175 | socket.current_map = ob->map; |