… | |
… | |
419 | sprintf (buf, "Player: %s the %s", (const char *) pl->name, (const char *) pl->contr->title); |
419 | sprintf (buf, "Player: %s the %s", (const char *) pl->name, (const char *) pl->contr->title); |
420 | else |
420 | else |
421 | sprintf (buf, "Player: %s %s", (const char *) pl->name, (const char *) pl->contr->own_title); |
421 | sprintf (buf, "Player: %s %s", (const char *) pl->name, (const char *) pl->contr->own_title); |
422 | } |
422 | } |
423 | |
423 | |
|
|
424 | // formerly a macro, used only by magic map, so optimised it out |
|
|
425 | static inline faceidx |
|
|
426 | GET_MAP_FACE (maptile *m, int x, int y, int layer) |
|
|
427 | { |
|
|
428 | if (object *op = GET_MAP_FACE_OBJ (m, x, y, layer)) |
|
|
429 | return op->face; |
|
|
430 | else |
|
|
431 | return 0; |
|
|
432 | } |
424 | |
433 | |
425 | /** |
434 | /** |
426 | * Helper for magic map creation. |
435 | * Helper for magic map creation. |
427 | * |
436 | * |
428 | * Takes a player, the map_mark array and an x and y starting position. |
437 | * Takes a player, the map_mark array and an x and y starting position. |
… | |
… | |
437 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
446 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
438 | { |
447 | { |
439 | int x, y, dx, dy, mflags; |
448 | int x, y, dx, dy, mflags; |
440 | sint16 nx, ny; |
449 | sint16 nx, ny; |
441 | maptile *mp; |
450 | maptile *mp; |
442 | facetile *f; |
|
|
443 | |
451 | |
444 | for (dx = -1; dx <= 1; dx++) |
452 | for (dx = -1; dx <= 1; dx++) |
445 | { |
453 | { |
446 | for (dy = -1; dy <= 1; dy++) |
454 | for (dy = -1; dy <= 1; dy++) |
447 | { |
455 | { |
… | |
… | |
459 | if (mflags & P_OUT_OF_MAP) |
467 | if (mflags & P_OUT_OF_MAP) |
460 | continue; |
468 | continue; |
461 | |
469 | |
462 | if (map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] == 0) |
470 | if (map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] == 0) |
463 | { |
471 | { |
464 | f = GET_MAP_FACE (mp, nx, ny, 0); |
472 | int f = GET_MAP_FACE (mp, nx, ny, 0); |
465 | if (f == blank_face) |
473 | if (f == blank_face) |
|
|
474 | { |
466 | f = GET_MAP_FACE (mp, nx, ny, 1); |
475 | f = GET_MAP_FACE (mp, nx, ny, 1); |
467 | if (f == blank_face) |
476 | if (f == blank_face) |
468 | f = GET_MAP_FACE (mp, nx, ny, 2); |
477 | f = GET_MAP_FACE (mp, nx, ny, 2); |
|
|
478 | } |
|
|
479 | |
|
|
480 | int magicmap = faces [f].magicmap; |
469 | |
481 | |
470 | /* Should probably have P_NO_MAGIC here also, but then shops don't |
482 | /* Should probably have P_NO_MAGIC here also, but then shops don't |
471 | * work. |
483 | * work. |
472 | */ |
484 | */ |
473 | if (mflags & P_BLOCKSVIEW) |
485 | if (mflags & P_BLOCKSVIEW) |
474 | map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_WALL | (f ? f->magicmap : 0); |
486 | map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_WALL | magicmap; |
475 | else |
487 | else |
476 | { |
488 | { |
477 | map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_FLOOR | (f ? f->magicmap : 0); |
489 | map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_FLOOR | magicmap; |
478 | magic_mapping_mark_recursive (pl, map_mark, x, y); |
490 | magic_mapping_mark_recursive (pl, map_mark, x, y); |
479 | } |
491 | } |
480 | } |
492 | } |
481 | } |
493 | } |
482 | } |
494 | } |
483 | } |
495 | } |
484 | |
|
|
485 | |
496 | |
486 | /** |
497 | /** |
487 | * Creates magic map for player. |
498 | * Creates magic map for player. |
488 | * |
499 | * |
489 | * Note: For improved magic mapping display, the space that blocks |
500 | * Note: For improved magic mapping display, the space that blocks |
… | |
… | |
496 | * is for open spaces. map_mark should already have been initialised |
507 | * is for open spaces. map_mark should already have been initialised |
497 | * to zero before this is called. |
508 | * to zero before this is called. |
498 | * strength is an initial strength*2 rectangular area that we automatically |
509 | * strength is an initial strength*2 rectangular area that we automatically |
499 | * see in/penetrate through. |
510 | * see in/penetrate through. |
500 | */ |
511 | */ |
501 | |
|
|
502 | void |
512 | void |
503 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
513 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
504 | { |
514 | { |
505 | int x, y, mflags; |
515 | int x, y, mflags; |
506 | sint16 nx, ny; |
516 | sint16 nx, ny; |
507 | maptile *mp; |
517 | maptile *mp; |
508 | facetile *f; |
|
|
509 | |
518 | |
510 | for (x = -strength; x < strength; x++) |
519 | for (x = -strength; x < strength; x++) |
511 | { |
520 | { |
512 | for (y = -strength; y < strength; y++) |
521 | for (y = -strength; y < strength; y++) |
513 | { |
522 | { |
514 | mp = pl->map; |
523 | mp = pl->map; |
515 | nx = pl->x + x; |
524 | nx = pl->x + x; |
516 | ny = pl->y + y; |
525 | ny = pl->y + y; |
|
|
526 | |
517 | mflags = get_map_flags (pl->map, &mp, nx, ny, &nx, &ny); |
527 | mflags = get_map_flags (pl->map, &mp, nx, ny, &nx, &ny); |
518 | if (mflags & P_OUT_OF_MAP) |
528 | if (mflags & P_OUT_OF_MAP) |
519 | continue; |
529 | continue; |
520 | else |
530 | |
|
|
531 | int f = GET_MAP_FACE (mp, nx, ny, 0); |
|
|
532 | if (f == blank_face) |
521 | { |
533 | { |
522 | f = GET_MAP_FACE (mp, nx, ny, 0); |
|
|
523 | if (f == blank_face) |
|
|
524 | f = GET_MAP_FACE (mp, nx, ny, 1); |
534 | f = GET_MAP_FACE (mp, nx, ny, 1); |
525 | if (f == blank_face) |
535 | if (f == blank_face) |
526 | f = GET_MAP_FACE (mp, nx, ny, 2); |
536 | f = GET_MAP_FACE (mp, nx, ny, 2); |
527 | } |
537 | } |
528 | |
538 | |
|
|
539 | int magicmap = faces [f].magicmap; |
|
|
540 | |
529 | if (mflags & P_BLOCKSVIEW) |
541 | if (mflags & P_BLOCKSVIEW) |
530 | map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_WALL | (f ? f->magicmap : 0); |
542 | map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_WALL | magicmap; |
531 | else |
543 | else |
532 | { |
544 | { |
533 | map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_FLOOR | (f ? f->magicmap : 0); |
545 | map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_FLOOR | magicmap; |
534 | magic_mapping_mark_recursive (pl, map_mark, x, y); |
546 | magic_mapping_mark_recursive (pl, map_mark, x, y); |
535 | } |
547 | } |
536 | } |
548 | } |
537 | } |
549 | } |
538 | } |
550 | } |