… | |
… | |
63 | {KW_body_foot , "You can put it on your foot" , "It goes on a human's foot"}, |
63 | {KW_body_foot , "You can put it on your foot" , "It goes on a human's foot"}, |
64 | {KW_body_hand , "You can put it on your hand" , "It goes on a human's hand"}, |
64 | {KW_body_hand , "You can put it on your hand" , "It goes on a human's hand"}, |
65 | {KW_body_wrist , "You can wear it around your wrist" , "It goes around a human's wrist"}, |
65 | {KW_body_wrist , "You can wear it around your wrist" , "It goes around a human's wrist"}, |
66 | {KW_body_waist , "You can wear it around your waist" , "It goes around a human's waist"}, |
66 | {KW_body_waist , "You can wear it around your waist" , "It goes around a human's waist"}, |
67 | /*{"body_dragon_torso", "your body", "a dragon's body"} */ |
67 | /*{"body_dragon_torso", "your body", "a dragon's body"} */ |
68 | }; |
|
|
69 | |
|
|
70 | static char numbers[21][20] = { |
|
|
71 | "no", "", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", |
|
|
72 | "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", |
|
|
73 | "eighteen", "nineteen", "twenty" |
|
|
74 | }; |
68 | }; |
75 | |
69 | |
76 | static char numbers_10[10][20] = { |
70 | static char numbers_10[10][20] = { |
77 | "zero", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", |
71 | "zero", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", |
78 | "eighty", "ninety" |
72 | "eighty", "ninety" |
… | |
… | |
207 | {BUILDER, "item builder", "item builders", 0, 0}, |
201 | {BUILDER, "item builder", "item builders", 0, 0}, |
208 | {MATERIAL, "building material", "building materials", 0, 0}, |
202 | {MATERIAL, "building material", "building materials", 0, 0}, |
209 | {ITEM_TRANSFORMER, "item_transformer", "item_transformers", 0, 0}, |
203 | {ITEM_TRANSFORMER, "item_transformer", "item_transformers", 0, 0}, |
210 | }; |
204 | }; |
211 | |
205 | |
212 | const int item_types_size = sizeof (item_types) / sizeof (*item_types); |
206 | static const int item_types_size = sizeof (item_types) / sizeof (*item_types); |
213 | |
207 | |
214 | materialtype_t *materialt; |
208 | materialtype_t *materialt; |
215 | |
209 | |
216 | /* |
210 | /* |
217 | materialtype material[NROFMATERIALS] = { |
211 | materialtype material[NROFMATERIALS] = { |
… | |
… | |
381 | * but do put a newline at the end. Useful when dumping to files |
375 | * but do put a newline at the end. Useful when dumping to files |
382 | */ |
376 | */ |
383 | const char * |
377 | const char * |
384 | describe_resistance (const object *op, int newline) |
378 | describe_resistance (const object *op, int newline) |
385 | { |
379 | { |
386 | static char buf[VERY_BIG_BUF]; |
380 | static dynbuf_text buf; buf.clear (); |
387 | char buf1[VERY_BIG_BUF]; |
|
|
388 | int tmpvar; |
|
|
389 | |
381 | |
390 | buf[0] = 0; |
382 | for (int i = 0; i < NROFATTACKS; i++) |
391 | for (tmpvar = 0; tmpvar < NROFATTACKS; tmpvar++) |
|
|
392 | { |
|
|
393 | if (op->resist[tmpvar] && (op->type != FLESH || atnr_is_dragon_enabled (tmpvar) == 1)) |
383 | if (op->resist[i] && (op->type != FLESH || atnr_is_dragon_enabled (i) == 1)) |
394 | { |
384 | buf.printf (newline ? "%s %d\n" : "(%s %+d)", resist_plus[i], op->resist[i]); |
395 | if (!newline) |
|
|
396 | sprintf (buf1, "(%s %+d)", resist_plus[tmpvar], op->resist[tmpvar]); |
|
|
397 | else |
|
|
398 | sprintf (buf1, "%s %d\n", resist_plus[tmpvar], op->resist[tmpvar]); |
|
|
399 | |
|
|
400 | strcat (buf, buf1); |
|
|
401 | } |
|
|
402 | } |
|
|
403 | |
385 | |
404 | return buf; |
386 | return buf; |
405 | } |
387 | } |
406 | |
|
|
407 | |
388 | |
408 | /* |
389 | /* |
409 | * query_weight(object) returns a character pointer to a static buffer |
390 | * query_weight(object) returns a character pointer to a static buffer |
410 | * containing the text-representation of the weight of the given object. |
391 | * containing the text-representation of the weight of the given object. |
411 | * The buffer will be overwritten by the next call to query_weight(). |
392 | * The buffer will be overwritten by the next call to query_weight(). |
… | |
… | |
451 | return levelnumbers_10[i / 10]; |
432 | return levelnumbers_10[i / 10]; |
452 | |
433 | |
453 | strcpy (buf, numbers_10[i / 10]); |
434 | strcpy (buf, numbers_10[i / 10]); |
454 | strcat (buf, levelnumbers[i % 10]); |
435 | strcat (buf, levelnumbers[i % 10]); |
455 | return buf; |
436 | return buf; |
456 | } |
|
|
457 | |
|
|
458 | /* |
|
|
459 | * get_number(integer) returns the text-representation of the given number |
|
|
460 | * in a static buffer. The buffer might be overwritten at the next |
|
|
461 | * call to get_number(). |
|
|
462 | * It is currently only used by the query_name() function. |
|
|
463 | */ |
|
|
464 | const char * |
|
|
465 | get_number (int i) |
|
|
466 | { |
|
|
467 | if (i <= 20) |
|
|
468 | return numbers[i]; |
|
|
469 | else |
|
|
470 | { |
|
|
471 | static char buf[MAX_BUF]; |
|
|
472 | |
|
|
473 | sprintf (buf, "%d", i); |
|
|
474 | return buf; |
|
|
475 | } |
|
|
476 | } |
437 | } |
477 | |
438 | |
478 | /* |
439 | /* |
479 | * Returns pointer to static buffer containing ring's or amulet's |
440 | * Returns pointer to static buffer containing ring's or amulet's |
480 | * abilities |
441 | * abilities |
… | |
… | |
486 | */ |
447 | */ |
487 | |
448 | |
488 | /* Aug 95 modified this slightly so that Skill tools don't have magic bonus |
449 | /* Aug 95 modified this slightly so that Skill tools don't have magic bonus |
489 | * from stats.sp - b.t. |
450 | * from stats.sp - b.t. |
490 | */ |
451 | */ |
491 | const char * |
452 | static const char * |
492 | ring_desc (const object *op) |
453 | ring_desc (const object *op) |
493 | { |
454 | { |
494 | static dynbuf_text buf; buf.clear (); |
455 | static dynbuf_text buf; buf.clear (); |
495 | int attr, val, len; |
456 | int attr, val, len; |
496 | |
457 | |
… | |
… | |
649 | |
610 | |
650 | buf << query_short_name (op); |
611 | buf << query_short_name (op); |
651 | |
612 | |
652 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
613 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
653 | buf << " *"; |
614 | buf << " *"; |
654 | if (op->type == CONTAINER && ((op->env && op->env->container == op) || (!op->env && QUERY_FLAG (op, FLAG_APPLIED)))) |
615 | if (op->is_open_container ()) |
655 | buf << " (open)"; |
616 | buf << " (open)"; |
656 | |
617 | |
657 | if (QUERY_FLAG (op, FLAG_KNOWN_CURSED)) |
618 | if (QUERY_FLAG (op, FLAG_KNOWN_CURSED)) |
658 | { |
619 | { |
659 | if (QUERY_FLAG (op, FLAG_DAMNED)) |
620 | if (QUERY_FLAG (op, FLAG_DAMNED)) |
… | |
… | |
827 | /* Note that the resolution this provides for players really isn't |
788 | /* Note that the resolution this provides for players really isn't |
828 | * very good. Any player with a speed greater than .67 will |
789 | * very good. Any player with a speed greater than .67 will |
829 | * fall into the 'lightning fast movement' category. |
790 | * fall into the 'lightning fast movement' category. |
830 | */ |
791 | */ |
831 | if (op->has_active_speed ()) |
792 | if (op->has_active_speed ()) |
832 | switch ((int) ((FABS (op->speed)) * 15)) |
793 | switch ((int)((fabs (op->speed)) * 15.)) |
833 | { |
794 | { |
834 | case 0: |
795 | case 0: |
835 | buf << "(very slow movement)"; |
796 | buf << "(very slow movement)"; |
836 | break; |
797 | break; |
837 | case 1: |
798 | case 1: |