… | |
… | |
1964 | |
1964 | |
1965 | if (door->type == DOOR) |
1965 | if (door->type == DOOR) |
1966 | hit_player (door, 9998, op, AT_PHYSICAL, 1); /* Break through the door */ |
1966 | hit_player (door, 9998, op, AT_PHYSICAL, 1); /* Break through the door */ |
1967 | else if (door->type == LOCKED_DOOR) |
1967 | else if (door->type == LOCKED_DOOR) |
1968 | { |
1968 | { |
1969 | new_draw_info_format (NDI_UNIQUE, NDI_BROWN, op, "You open the door with the %s", query_short_name (key)); |
1969 | op->statusmsg (format ("You open the door with the %s", query_short_name (key)), NDI_BROWN); |
1970 | remove_door2 (door); /* remove door without violence ;-) */ |
1970 | remove_door2 (door); /* remove door without violence ;-) */ |
1971 | } |
1971 | } |
1972 | |
1972 | |
1973 | /* Do this after we print the message */ |
1973 | /* Do this after we print the message */ |
1974 | decrease_ob (key); /* Use up one of the keys */ |
1974 | decrease_ob (key); /* Use up one of the keys */ |
… | |
… | |
1979 | return 1; /* Nothing more to do below */ |
1979 | return 1; /* Nothing more to do below */ |
1980 | } |
1980 | } |
1981 | else if (door->type == LOCKED_DOOR) |
1981 | else if (door->type == LOCKED_DOOR) |
1982 | { |
1982 | { |
1983 | /* Might as well return now - no other way to open this */ |
1983 | /* Might as well return now - no other way to open this */ |
1984 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, door->msg); |
1984 | op->failmsg (door->msg ? &door->msg : "Hmm, you miss the certain something to open this door..."); |
1985 | return 1; |
1985 | return 1; |
1986 | } |
1986 | } |
1987 | |
1987 | |
1988 | return 0; |
1988 | return 0; |
1989 | } |
1989 | } |
… | |
… | |
2109 | { |
2109 | { |
2110 | op->play_sound (sound_find ("push_player")); |
2110 | op->play_sound (sound_find ("push_player")); |
2111 | push_ob (mon, dir, op); |
2111 | push_ob (mon, dir, op); |
2112 | } |
2112 | } |
2113 | else |
2113 | else |
2114 | new_draw_info (0, 0, op, "You withhold your attack"); |
2114 | op->statusmsg ("You withhold your attack"); |
2115 | |
2115 | |
2116 | if (op->contr->tmp_invis || op->hide) |
2116 | if (op->contr->tmp_invis || op->hide) |
2117 | make_visible (op); |
2117 | make_visible (op); |
2118 | |
2118 | |
2119 | return true; |
2119 | return true; |
… | |
… | |
2594 | * file. |
2594 | * file. |
2595 | */ |
2595 | */ |
2596 | void |
2596 | void |
2597 | kill_player (object *op) |
2597 | kill_player (object *op) |
2598 | { |
2598 | { |
|
|
2599 | int x, y; |
2599 | char buf[MAX_BUF]; |
2600 | char buf[MAX_BUF]; |
2600 | int x, y; |
|
|
2601 | |
|
|
2602 | //int i; |
|
|
2603 | maptile *map; /* this is for resurrection */ |
2601 | maptile *map; /* this is for resurrection */ |
2604 | |
|
|
2605 | /* int z; |
|
|
2606 | int num_stats_lose; |
|
|
2607 | int lost_a_stat; |
|
|
2608 | int lose_this_stat; |
|
|
2609 | int this_stat; */ |
|
|
2610 | int will_kill_again; |
2602 | int will_kill_again; |
2611 | archetype *at; |
2603 | archetype *at; |
2612 | object *tmp; |
2604 | object *tmp; |
2613 | |
2605 | |
2614 | if (save_life (op)) |
2606 | if (save_life (op)) |
… | |
… | |
2644 | op->stats.food = 999; |
2636 | op->stats.food = 999; |
2645 | |
2637 | |
2646 | /* create a bodypart-trophy to make the winner happy */ |
2638 | /* create a bodypart-trophy to make the winner happy */ |
2647 | if (object *tmp = arch_to_object (archetype::find ("finger"))) |
2639 | if (object *tmp = arch_to_object (archetype::find ("finger"))) |
2648 | { |
2640 | { |
2649 | sprintf (buf, "%s's finger", &op->name); |
2641 | tmp->name = format ("%s's finger" , &op->name); |
2650 | tmp->name = buf; |
2642 | tmp->name_pl = format ("%s's fingers", &op->name); |
2651 | sprintf (buf, " This finger has been cut off %s\n" |
2643 | tmp->msg = format ( |
2652 | " the %s, when he was defeated at\n level %d by %s.\n", |
2644 | "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n", |
2653 | &op->name, op->contr->title, (int) (op->level), op->contr->killer); |
2645 | &op->name, op->contr->title, (int) (op->level), op->contr->killer |
2654 | tmp->msg = buf; |
2646 | ); |
2655 | tmp->value = 0, tmp->type = 0; |
2647 | tmp->value = 0, tmp->type = 0; |
2656 | tmp->materialname = "organics"; |
2648 | tmp->materialname = "organics"; |
2657 | tmp->insert_at (op, tmp); |
2649 | tmp->insert_at (op, tmp); |
2658 | } |
2650 | } |
2659 | |
2651 | |
… | |
… | |
2666 | INVOKE_PLAYER (DEATH, op->contr); |
2658 | INVOKE_PLAYER (DEATH, op->contr); |
2667 | |
2659 | |
2668 | command_kill_pets (op, 0); |
2660 | command_kill_pets (op, 0); |
2669 | |
2661 | |
2670 | if (op->stats.food < 0) |
2662 | if (op->stats.food < 0) |
2671 | { |
|
|
2672 | sprintf (buf, "%s starved to death.", &op->name); |
|
|
2673 | strcpy (op->contr->killer, "starvation"); |
2663 | strcpy (op->contr->killer, "starvation"); |
2674 | } |
|
|
2675 | else |
|
|
2676 | sprintf (buf, "%s died.", &op->name); |
|
|
2677 | |
2664 | |
2678 | op->contr->play_sound (sound_find ("player_dies")); |
2665 | op->contr->play_sound (sound_find ("player_dies")); |
2679 | |
2666 | |
2680 | /* save the map location for corpse, gravestone */ |
2667 | /* save the map location for corpse, gravestone */ |
2681 | x = op->x; |
2668 | x = op->x; |
… | |
… | |
3496 | if (!IN_RANGE_EXC (x, 0, ns->mapx) || !IN_RANGE_EXC (y, 0, ns->mapy)) |
3483 | if (!IN_RANGE_EXC (x, 0, ns->mapx) || !IN_RANGE_EXC (y, 0, ns->mapy)) |
3497 | return 0; |
3484 | return 0; |
3498 | |
3485 | |
3499 | return 100 - blocked_los [x][y]; |
3486 | return 100 - blocked_los [x][y]; |
3500 | } |
3487 | } |
|
|
3488 | |
|
|
3489 | void |
|
|
3490 | player::infobox (const char *title, const char *msg, int color) |
|
|
3491 | { |
|
|
3492 | send_msg (color | NDI_DEF | NDI_REPLY | NDI_CLEAR, title, msg); |
|
|
3493 | } |
|
|
3494 | |
|
|
3495 | void |
|
|
3496 | player::statusmsg (const char *msg, int color) |
|
|
3497 | { |
|
|
3498 | send_msg (color | NDI_REPLY, INFO_CHANNEL, msg); |
|
|
3499 | } |
|
|
3500 | |
|
|
3501 | void |
|
|
3502 | player::failmsg (const char *msg, int color) |
|
|
3503 | { |
|
|
3504 | play_sound (sound_find ("generic_failure")); |
|
|
3505 | statusmsg (msg, color); |
|
|
3506 | } |
|
|
3507 | |