… | |
… | |
187 | } |
187 | } |
188 | |
188 | |
189 | void |
189 | void |
190 | draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage) |
190 | draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage) |
191 | { |
191 | { |
192 | |
|
|
193 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
192 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
194 | return; |
193 | return; |
195 | |
194 | |
196 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
195 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
197 | { |
196 | { |
… | |
… | |
237 | } |
236 | } |
238 | |
237 | |
239 | /** |
238 | /** |
240 | * Writes to everyone on the map *except* op. This is useful for emotions. |
239 | * Writes to everyone on the map *except* op. This is useful for emotions. |
241 | */ |
240 | */ |
242 | |
|
|
243 | void |
241 | void |
244 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
242 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
245 | { |
243 | { |
246 | for_all_players (pl) |
244 | for_all_players (pl) |
247 | if (pl->ob->map == map && pl->ob != op) |
245 | if (pl->ob->map == map && pl->ob != op) |
… | |
… | |
283 | sprintf (buf, "Player: %s %s", (const char *) pl->name, (const char *) pl->contr->own_title); |
281 | sprintf (buf, "Player: %s %s", (const char *) pl->name, (const char *) pl->contr->own_title); |
284 | } |
282 | } |
285 | |
283 | |
286 | // formerly a macro, used only by magic map, so optimised it out |
284 | // formerly a macro, used only by magic map, so optimised it out |
287 | static inline faceidx |
285 | static inline faceidx |
288 | GET_MAP_FACE (maptile *m, int x, int y, int layer) |
286 | GET_MAP_FACE (mapspace &ms, int layer) |
289 | { |
287 | { |
290 | if (object *op = GET_MAP_FACE_OBJ (m, x, y, layer)) |
288 | if (object *op = ms.faces_obj [layer]) |
291 | return op->face; |
289 | return op->face; |
292 | else |
290 | else |
293 | return 0; |
291 | return 0; |
294 | } |
292 | } |
295 | |
293 | |
… | |
… | |
305 | * for various code values. |
303 | * for various code values. |
306 | */ |
304 | */ |
307 | static void |
305 | static void |
308 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
306 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
309 | { |
307 | { |
310 | int x, y, dx, dy, mflags; |
|
|
311 | sint16 nx, ny; |
|
|
312 | maptile *mp; |
|
|
313 | |
|
|
314 | for (dx = -1; dx <= 1; dx++) |
308 | for (int dx = -1; dx <= 1; dx++) |
315 | { |
309 | { |
316 | for (dy = -1; dy <= 1; dy++) |
310 | for (int dy = -1; dy <= 1; dy++) |
317 | { |
311 | { |
318 | x = px + dx; |
312 | int x = px + dx; |
319 | y = py + dy; |
313 | int y = py + dy; |
320 | |
314 | |
321 | if (FABS (x) >= MAGIC_MAP_HALF || FABS (y) >= MAGIC_MAP_HALF) |
315 | if (abs (x) >= MAGIC_MAP_HALF || abs (y) >= MAGIC_MAP_HALF) |
322 | continue; |
316 | continue; |
323 | |
317 | |
324 | mp = pl->map; |
318 | mapxy pos (pl); |
325 | nx = pl->x + x; |
319 | pos.move (x, y); |
326 | ny = pl->y + y; |
|
|
327 | |
320 | |
328 | mflags = get_map_flags (pl->map, &mp, nx, ny, &nx, &ny); |
321 | if (!pos.normalise ()) |
329 | if (mflags & P_OUT_OF_MAP) |
|
|
330 | continue; |
322 | continue; |
|
|
323 | |
|
|
324 | mapspace &ms = pos.ms (); |
331 | |
325 | |
332 | if (map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] == 0) |
326 | if (map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] == 0) |
333 | { |
327 | { |
|
|
328 | int mflags = ms.flags (); |
|
|
329 | |
334 | int f = GET_MAP_FACE (mp, nx, ny, 0); |
330 | int f = GET_MAP_FACE (ms, 0); |
335 | if (f == blank_face) |
331 | if (f == blank_face) |
336 | { |
332 | { |
337 | f = GET_MAP_FACE (mp, nx, ny, 1); |
333 | f = GET_MAP_FACE (ms, 1); |
338 | if (f == blank_face) |
334 | if (f == blank_face) |
339 | f = GET_MAP_FACE (mp, nx, ny, 2); |
335 | f = GET_MAP_FACE (ms, 2); |
340 | } |
336 | } |
341 | |
337 | |
342 | int magicmap = faces [f].magicmap; |
338 | int magicmap = faces [f].magicmap; |
343 | |
339 | |
344 | /* Should probably have P_NO_MAGIC here also, but then shops don't |
340 | /* Should probably have P_NO_MAGIC here also, but then shops don't |
… | |
… | |
357 | } |
353 | } |
358 | |
354 | |
359 | /** |
355 | /** |
360 | * Creates magic map for player. |
356 | * Creates magic map for player. |
361 | * |
357 | * |
362 | * Note: For improved magic mapping display, the space that blocks |
358 | * Note: For improved magic mapping display, the space that blocks |
363 | * the view is now marked with value 2. Any dependencies of map_mark |
359 | * the view is now marked with value 2. Any dependencies of map_mark |
364 | * being nonzero have been changed to check for 1. Also, since |
360 | * being nonzero have been changed to check for 1. Also, since |
365 | * map_mark is a char value, putting 2 in should cause no problems. |
361 | * map_mark is a char value, putting 2 in should cause no problems. |
366 | * |
362 | * |
367 | * This function examines the map the player is on, and determines what |
363 | * This function examines the map the player is on, and determines what |
368 | * is visible. 2 is set for walls or objects that blocks view. 1 |
364 | * is visible. 2 is set for walls or objects that blocks view. 1 |
369 | * is for open spaces. map_mark should already have been initialised |
365 | * is for open spaces. map_mark should already have been initialised |
370 | * to zero before this is called. |
366 | * to zero before this is called. |
371 | * strength is an initial strength*2 rectangular area that we automatically |
367 | * strength is an initial strength*2 rectangular area that we automatically |
372 | * see in/penetrate through. |
368 | * see in/penetrate through. |
373 | */ |
369 | */ |
374 | void |
370 | void |
375 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
371 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
376 | { |
372 | { |
377 | int x, y, mflags; |
|
|
378 | sint16 nx, ny; |
|
|
379 | maptile *mp; |
|
|
380 | |
|
|
381 | for (x = -strength; x < strength; x++) |
373 | for (int x = -strength; x < strength; x++) |
382 | { |
374 | { |
383 | for (y = -strength; y < strength; y++) |
375 | for (int y = -strength; y < strength; y++) |
384 | { |
376 | { |
385 | mp = pl->map; |
377 | mapxy pos (pl); |
386 | nx = pl->x + x; |
378 | pos.move (x, y); |
387 | ny = pl->y + y; |
|
|
388 | |
379 | |
389 | mflags = get_map_flags (pl->map, &mp, nx, ny, &nx, &ny); |
380 | if (!pos.normalise ()) |
390 | if (mflags & P_OUT_OF_MAP) |
|
|
391 | continue; |
381 | continue; |
392 | |
382 | |
|
|
383 | mapspace &ms = pos.ms (); |
|
|
384 | |
|
|
385 | int mflags = ms.flags (); |
|
|
386 | |
393 | int f = GET_MAP_FACE (mp, nx, ny, 0); |
387 | int f = GET_MAP_FACE (ms, 0); |
394 | if (f == blank_face) |
388 | if (f == blank_face) |
395 | { |
389 | { |
396 | f = GET_MAP_FACE (mp, nx, ny, 1); |
390 | f = GET_MAP_FACE (ms, 1); |
397 | if (f == blank_face) |
391 | if (f == blank_face) |
398 | f = GET_MAP_FACE (mp, nx, ny, 2); |
392 | f = GET_MAP_FACE (ms, 2); |
399 | } |
393 | } |
400 | |
394 | |
401 | int magicmap = faces [f].magicmap; |
395 | int magicmap = faces [f].magicmap; |
402 | |
396 | |
403 | if (mflags & P_BLOCKSVIEW) |
397 | if (mflags & P_BLOCKSVIEW) |