… | |
… | |
456 | strcpy (buf, numbers_10[i / 10]); |
456 | strcpy (buf, numbers_10[i / 10]); |
457 | strcat (buf, levelnumbers[i % 10]); |
457 | strcat (buf, levelnumbers[i % 10]); |
458 | return buf; |
458 | return buf; |
459 | } |
459 | } |
460 | |
460 | |
461 | |
|
|
462 | /* |
461 | /* |
463 | * get_number(integer) returns the text-representation of the given number |
462 | * get_number(integer) returns the text-representation of the given number |
464 | * in a static buffer. The buffer might be overwritten at the next |
463 | * in a static buffer. The buffer might be overwritten at the next |
465 | * call to get_number(). |
464 | * call to get_number(). |
466 | * It is currently only used by the query_name() function. |
465 | * It is currently only used by the query_name() function. |
467 | */ |
466 | */ |
468 | |
|
|
469 | char * |
467 | char * |
470 | get_number (int i) |
468 | get_number (int i) |
471 | { |
469 | { |
472 | if (i <= 20) |
470 | if (i <= 20) |
473 | return numbers[i]; |
471 | return numbers[i]; |
… | |
… | |
647 | * |
645 | * |
648 | */ |
646 | */ |
649 | char * |
647 | char * |
650 | query_name (const object *op) |
648 | query_name (const object *op) |
651 | { |
649 | { |
652 | static char buf[5][HUGE_BUF]; |
650 | static char buf[5][HUGE_BUF]; // OMFG |
653 | static int use_buf = 0; |
651 | static int use_buf = 0; |
654 | int len = 0; |
652 | int len = 0; |
655 | |
653 | |
656 | #ifdef NEW_MATERIAL_CODE |
654 | #ifdef NEW_MATERIAL_CODE |
657 | materialtype_t *mt; |
655 | materialtype_t *mt; |
… | |
… | |
684 | if (QUERY_FLAG (op, FLAG_DAMNED)) |
682 | if (QUERY_FLAG (op, FLAG_DAMNED)) |
685 | safe_strcat (buf[use_buf], " (damned)", &len, HUGE_BUF); |
683 | safe_strcat (buf[use_buf], " (damned)", &len, HUGE_BUF); |
686 | else if (QUERY_FLAG (op, FLAG_CURSED)) |
684 | else if (QUERY_FLAG (op, FLAG_CURSED)) |
687 | safe_strcat (buf[use_buf], " (cursed)", &len, HUGE_BUF); |
685 | safe_strcat (buf[use_buf], " (cursed)", &len, HUGE_BUF); |
688 | } |
686 | } |
|
|
687 | |
689 | /* Basically, if the object is known magical (detect magic spell on it), |
688 | /* Basically, if the object is known magical (detect magic spell on it), |
690 | * and it isn't identified, print out the fact that |
689 | * and it isn't identified, print out the fact that |
691 | * it is magical. Assume that the detect magical spell will only set |
690 | * it is magical. Assume that the detect magical spell will only set |
692 | * KNOWN_MAGICAL if the item actually is magical. |
691 | * KNOWN_MAGICAL if the item actually is magical. |
693 | * |
692 | * |
… | |
… | |
709 | |
708 | |
710 | if (QUERY_FLAG (op, FLAG_APPLIED)) |
709 | if (QUERY_FLAG (op, FLAG_APPLIED)) |
711 | { |
710 | { |
712 | switch (op->type) |
711 | switch (op->type) |
713 | { |
712 | { |
714 | case BOW: |
713 | case BOW: |
715 | case WAND: |
714 | case WAND: |
716 | case ROD: |
715 | case ROD: |
717 | case HORN: |
716 | case HORN: |
718 | safe_strcat (buf[use_buf], " (readied)", &len, HUGE_BUF); |
717 | safe_strcat (buf[use_buf], " (readied)", &len, HUGE_BUF); |
719 | break; |
718 | break; |
720 | case WEAPON: |
719 | case WEAPON: |
721 | safe_strcat (buf[use_buf], " (wielded)", &len, HUGE_BUF); |
720 | safe_strcat (buf[use_buf], " (wielded)", &len, HUGE_BUF); |
722 | break; |
721 | break; |
723 | case ARMOUR: |
722 | case ARMOUR: |
724 | case HELMET: |
723 | case HELMET: |
725 | case SHIELD: |
724 | case SHIELD: |
726 | case RING: |
725 | case RING: |
727 | case BOOTS: |
726 | case BOOTS: |
728 | case GLOVES: |
727 | case GLOVES: |
729 | case AMULET: |
728 | case AMULET: |
730 | case GIRDLE: |
729 | case GIRDLE: |
731 | case BRACERS: |
730 | case BRACERS: |
732 | case CLOAK: |
731 | case CLOAK: |
733 | safe_strcat (buf[use_buf], " (worn)", &len, HUGE_BUF); |
732 | safe_strcat (buf[use_buf], " (worn)", &len, HUGE_BUF); |
734 | break; |
733 | break; |
735 | case CONTAINER: |
734 | case CONTAINER: |
736 | safe_strcat (buf[use_buf], " (active)", &len, HUGE_BUF); |
735 | safe_strcat (buf[use_buf], " (active)", &len, HUGE_BUF); |
737 | break; |
736 | break; |
738 | case SKILL: |
737 | case SKILL: |
739 | default: |
738 | default: |
740 | safe_strcat (buf[use_buf], " (applied)", &len, HUGE_BUF); |
739 | safe_strcat (buf[use_buf], " (applied)", &len, HUGE_BUF); |
741 | } |
740 | } |
742 | } |
741 | } |
|
|
742 | |
743 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
743 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
744 | safe_strcat (buf[use_buf], " (unpaid)", &len, HUGE_BUF); |
744 | safe_strcat (buf[use_buf], " (unpaid)", &len, HUGE_BUF); |
745 | |
745 | |
746 | return buf[use_buf]; |
746 | return buf [use_buf]; |
747 | } |
747 | } |
748 | |
748 | |
749 | /* |
749 | /* |
750 | * query_base_name(object) returns a character pointer pointing to a static |
750 | * query_base_name(object) returns a character pointer pointing to a static |
751 | * buffer which contains a verbose textual representation of the name |
751 | * buffer which contains a verbose textual representation of the name |
… | |
… | |
785 | } |
785 | } |
786 | else |
786 | else |
787 | { |
787 | { |
788 | #endif |
788 | #endif |
789 | if (!plural) |
789 | if (!plural) |
790 | strcpy (buf, op->name); |
790 | assign (buf, op->name); |
791 | else |
791 | else |
792 | strcpy (buf, op->name_pl); |
792 | assign (buf, op->name_pl); |
|
|
793 | |
793 | len = strlen (buf); |
794 | len = strlen (buf); |
794 | #ifdef NEW_MATERIAL_CODE |
795 | #ifdef NEW_MATERIAL_CODE |
795 | } |
796 | } |
796 | #endif |
797 | #endif |
797 | |
798 | |
… | |
… | |
801 | safe_strcat (buf, op->title, &len, MAX_BUF); |
802 | safe_strcat (buf, op->title, &len, MAX_BUF); |
802 | } |
803 | } |
803 | |
804 | |
804 | switch (op->type) |
805 | switch (op->type) |
805 | { |
806 | { |
806 | case SPELLBOOK: |
807 | case SPELLBOOK: |
807 | case SCROLL: |
808 | case SCROLL: |
808 | case WAND: |
809 | case WAND: |
809 | case ROD: |
810 | case ROD: |
810 | if (QUERY_FLAG (op, FLAG_IDENTIFIED) || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
811 | if (QUERY_FLAG (op, FLAG_IDENTIFIED) || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
811 | { |
812 | { |
812 | if (!op->title) |
813 | if (!op->title) |
813 | { |
814 | { |
814 | safe_strcat (buf, " of ", &len, MAX_BUF); |
815 | safe_strcat (buf, " of ", &len, MAX_BUF); |
815 | if (op->inv) |
816 | if (op->inv) |
816 | safe_strcat (buf, op->inv->name, &len, MAX_BUF); |
817 | safe_strcat (buf, op->inv->name, &len, MAX_BUF); |
817 | else |
818 | else |
818 | LOG (llevError, "Spellbook %s lacks inventory\n", &op->name); |
819 | LOG (llevError, "Spellbook %s lacks inventory\n", &op->name); |
819 | } |
820 | } |
820 | if (op->type != SPELLBOOK) |
821 | if (op->type != SPELLBOOK) |
821 | { |
822 | { |
822 | sprintf (buf2, " (lvl %d)", op->level); |
823 | sprintf (buf2, " (lvl %d)", op->level); |
823 | safe_strcat (buf, buf2, &len, MAX_BUF); |
824 | safe_strcat (buf, buf2, &len, MAX_BUF); |
824 | } |
825 | } |
825 | } |
826 | } |
826 | break; |
827 | break; |
827 | |
828 | |
828 | |
829 | |
829 | case SKILL: |
830 | case SKILL: |
830 | case AMULET: |
831 | case AMULET: |
831 | case RING: |
832 | case RING: |
832 | if (!op->title) |
833 | if (!op->title) |
833 | { |
834 | { |
834 | /* If ring has a title, full description isn't so useful */ |
835 | /* If ring has a title, full description isn't so useful */ |
835 | char *s = ring_desc (op); |
836 | char *s = ring_desc (op); |
836 | |
837 | |
837 | if (s[0]) |
838 | if (s[0]) |
838 | { |
839 | { |
839 | safe_strcat (buf, " ", &len, MAX_BUF); |
840 | safe_strcat (buf, " ", &len, MAX_BUF); |
840 | safe_strcat (buf, s, &len, MAX_BUF); |
841 | safe_strcat (buf, s, &len, MAX_BUF); |
841 | } |
842 | } |
842 | } |
843 | } |
843 | break; |
844 | break; |
844 | default: |
845 | default: |
845 | if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) |
846 | if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) |
846 | { |
847 | { |
847 | sprintf (buf + strlen (buf), " %+d", op->magic); |
848 | sprintf (buf + strlen (buf), " %+d", op->magic); |
848 | } |
849 | } |
849 | } |
850 | } |
|
|
851 | |
850 | return buf; |
852 | return buf; |
851 | } |
853 | } |
852 | |
854 | |
853 | /* Break this off from describe_item - that function was way |
855 | /* Break this off from describe_item - that function was way |
854 | * too long, making it difficult to read. This function deals |
856 | * too long, making it difficult to read. This function deals |
855 | * with describing the monsters & players abilities. It should only |
857 | * with describing the monsters & players abilities. It should only |
856 | * be called with monster & player objects. Returns a description |
858 | * be called with monster & player objects. Returns a description |
857 | * in a static buffer. |
859 | * in a static buffer. |
858 | */ |
860 | */ |
859 | |
|
|
860 | static char * |
861 | static char * |
861 | describe_monster (const object *op) |
862 | describe_monster (const object *op) |
862 | { |
863 | { |
863 | char buf[MAX_BUF]; |
864 | char buf[MAX_BUF]; |
864 | static char retbuf[VERY_BIG_BUF]; |
865 | static char retbuf[VERY_BIG_BUF]; |
… | |
… | |
990 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
991 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
991 | if (tmp->type == SKILL && !strcmp (tmp->name, "clawing")) |
992 | if (tmp->type == SKILL && !strcmp (tmp->name, "clawing")) |
992 | break; |
993 | break; |
993 | |
994 | |
994 | if (tmp && tmp->attacktype != 0) |
995 | if (tmp && tmp->attacktype != 0) |
995 | { |
|
|
996 | DESCRIBE_ABILITY (retbuf, tmp->attacktype, "Claws"); |
996 | { DESCRIBE_ABILITY (retbuf, tmp->attacktype, "Claws") } |
997 | } |
|
|
998 | else |
997 | else |
999 | { |
|
|
1000 | DESCRIBE_ABILITY (retbuf, op->attacktype, "Attacks"); |
998 | { DESCRIBE_ABILITY (retbuf, op->attacktype, "Attacks") } |
1001 | } |
|
|
1002 | } |
999 | } |
1003 | else |
1000 | else |
1004 | { |
|
|
1005 | DESCRIBE_ABILITY (retbuf, op->attacktype, "Attacks"); |
1001 | { DESCRIBE_ABILITY (retbuf, op->attacktype, "Attacks") } |
1006 | } |
1002 | |
1007 | DESCRIBE_PATH (retbuf, op->path_attuned, "Attuned"); |
1003 | DESCRIBE_PATH (retbuf, op->path_attuned, "Attuned"); |
1008 | DESCRIBE_PATH (retbuf, op->path_repelled, "Repelled"); |
1004 | DESCRIBE_PATH (retbuf, op->path_repelled, "Repelled"); |
1009 | DESCRIBE_PATH (retbuf, op->path_denied, "Denied"); |
1005 | DESCRIBE_PATH (retbuf, op->path_denied, "Denied"); |
|
|
1006 | |
1010 | for (i = 0; i < NROFATTACKS; i++) |
1007 | for (i = 0; i < NROFATTACKS; i++) |
1011 | { |
|
|
1012 | if (op->resist[i]) |
1008 | if (op->resist[i]) |
1013 | { |
1009 | { |
1014 | sprintf (buf, "(%s %+d)", resist_plus[i], op->resist[i]); |
1010 | sprintf (buf, "(%s %+d)", resist_plus[i], op->resist[i]); |
1015 | strcat (retbuf, buf); |
1011 | strcat (retbuf, buf); |
1016 | } |
1012 | } |
1017 | } |
1013 | |
1018 | return retbuf; |
1014 | return retbuf; |
1019 | } |
1015 | } |
1020 | |
1016 | |
1021 | |
1017 | |
1022 | /* |
1018 | /* |