| 2616 | | * Hack -- Calculates the total number of points earned |
|---|
| 2617 | | */ |
|---|
| 2618 | | long total_points(void) |
|---|
| 2619 | | { |
|---|
| 2620 | | return (p_ptr->max_exp + (100 * p_ptr->max_depth)); |
|---|
| 2621 | | } |
|---|
| 2622 | | |
|---|
| 2623 | | |
|---|
| 2624 | | |
|---|
| 2625 | | /* |
|---|
| 2626 | | * Centers a string within a 31 character string |
|---|
| 2627 | | */ |
|---|
| 2628 | | static void center_string(char *buf, size_t len, cptr str) |
|---|
| 2629 | | { |
|---|
| 2630 | | int i, j; |
|---|
| 2631 | | |
|---|
| 2632 | | /* Total length */ |
|---|
| 2633 | | i = strlen(str); |
|---|
| 2634 | | |
|---|
| 2635 | | /* Necessary border */ |
|---|
| 2636 | | j = 15 - i / 2; |
|---|
| 2637 | | |
|---|
| 2638 | | /* Mega-Hack */ |
|---|
| 2639 | | strnfmt(buf, len, "%*s%s%*s", j, "", str, 31 - i - j, ""); |
|---|
| 2640 | | } |
|---|
| 2641 | | |
|---|
| 2642 | | |
|---|
| 2643 | | |
|---|
| 2644 | | |
|---|
| 2645 | | |
|---|
| 2646 | | /* |
|---|
| 2647 | | * Hack - save the time of death |
|---|
| 2648 | | */ |
|---|
| 2649 | | static time_t death_time = (time_t)0; |
|---|
| 2650 | | |
|---|
| 2651 | | |
|---|
| 2652 | | /* |
|---|
| 2653 | | * Display a "tomb-stone" |
|---|
| 2654 | | */ |
|---|
| 2655 | | static void print_tomb(void) |
|---|
| 2656 | | { |
|---|
| 2657 | | cptr p; |
|---|
| 2658 | | |
|---|
| 2659 | | char tmp[160]; |
|---|
| 2660 | | char buf[1024]; |
|---|
| 2661 | | |
|---|
| 2662 | | ang_file *fp; |
|---|
| 2663 | | |
|---|
| 2664 | | int line = 7; |
|---|
| 2665 | | |
|---|
| 2666 | | |
|---|
| 2667 | | /* Clear screen */ |
|---|
| 2668 | | Term_clear(); |
|---|
| 2669 | | |
|---|
| 2670 | | /* Open the death file */ |
|---|
| 2671 | | path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "dead.txt"); |
|---|
| 2672 | | fp = file_open(buf, MODE_READ, -1); |
|---|
| 2673 | | |
|---|
| 2674 | | /* Dump */ |
|---|
| 2675 | | if (fp) |
|---|
| 2676 | | { |
|---|
| 2677 | | int i = 0; |
|---|
| 2678 | | |
|---|
| 2679 | | /* Dump the file to the screen */ |
|---|
| 2680 | | while (file_getl(fp, buf, sizeof(buf))) |
|---|
| 2681 | | put_str(buf, i++, 0); |
|---|
| 2682 | | |
|---|
| 2683 | | file_close(fp); |
|---|
| 2684 | | } |
|---|
| 2685 | | |
|---|
| 2686 | | |
|---|
| 2687 | | /* Get the right total */ |
|---|
| 2688 | | if (p_ptr->total_winner) |
|---|
| 2689 | | p = "Magnificent"; |
|---|
| 2690 | | else |
|---|
| 2691 | | p = c_text + cp_ptr->title[(p_ptr->lev - 1) / 5]; |
|---|
| 2692 | | |
|---|
| 2693 | | center_string(buf, sizeof(buf), op_ptr->full_name); |
|---|
| 2694 | | put_str(buf, line++, 8); |
|---|
| 2695 | | |
|---|
| 2696 | | center_string(buf, sizeof(buf), "the"); |
|---|
| 2697 | | put_str(buf, line++, 8); |
|---|
| 2698 | | |
|---|
| 2699 | | center_string(buf, sizeof(buf), p); |
|---|
| 2700 | | put_str(buf, line++, 8); |
|---|
| 2701 | | |
|---|
| 2702 | | line++; |
|---|
| 2703 | | |
|---|
| 2704 | | center_string(buf, sizeof(buf), c_name + cp_ptr->name); |
|---|
| 2705 | | put_str(buf, line++, 8); |
|---|
| 2706 | | |
|---|
| 2707 | | strnfmt(tmp, sizeof(tmp), "Level: %d", (int)p_ptr->lev); |
|---|
| 2708 | | center_string(buf, sizeof(buf), tmp); |
|---|
| 2709 | | put_str(buf, line++, 8); |
|---|
| 2710 | | |
|---|
| 2711 | | strnfmt(tmp, sizeof(tmp), "Exp: %ld", (long)p_ptr->exp); |
|---|
| 2712 | | center_string(buf, sizeof(buf), tmp); |
|---|
| 2713 | | put_str(buf, line++, 8); |
|---|
| 2714 | | |
|---|
| 2715 | | strnfmt(tmp, sizeof(tmp), "AU: %ld", (long)p_ptr->au); |
|---|
| 2716 | | center_string(buf, sizeof(buf), tmp); |
|---|
| 2717 | | put_str(buf, line++, 8); |
|---|
| 2718 | | |
|---|
| 2719 | | strnfmt(tmp, sizeof(tmp), "Killed on Level %d", p_ptr->depth); |
|---|
| 2720 | | center_string(buf, sizeof(buf), tmp); |
|---|
| 2721 | | put_str(buf, line++, 8); |
|---|
| 2722 | | |
|---|
| 2723 | | strnfmt(tmp, sizeof(tmp), "by %s.", p_ptr->died_from); |
|---|
| 2724 | | center_string(buf, sizeof(buf), tmp); |
|---|
| 2725 | | put_str(buf, line++, 8); |
|---|
| 2726 | | |
|---|
| 2727 | | line++; |
|---|
| 2728 | | |
|---|
| 2729 | | strnfmt(tmp, sizeof(tmp), "%-.24s", ctime(&death_time)); |
|---|
| 2730 | | center_string(buf, sizeof(buf), tmp); |
|---|
| 2731 | | put_str(buf, line++, 8); |
|---|
| 2732 | | } |
|---|
| 2733 | | |
|---|
| 2734 | | |
|---|
| 2735 | | /* |
|---|
| 2736 | | * Hack - Know inventory and home items upon death |
|---|
| 2737 | | */ |
|---|
| 2738 | | static void death_knowledge(void) |
|---|
| 2739 | | { |
|---|
| 2740 | | int i; |
|---|
| 2741 | | |
|---|
| 2742 | | object_type *o_ptr; |
|---|
| 2743 | | |
|---|
| 2744 | | store_type *st_ptr = &store[STORE_HOME]; |
|---|
| 2745 | | |
|---|
| 2746 | | |
|---|
| 2747 | | /* Hack -- Know everything in the inven/equip */ |
|---|
| 2748 | | for (i = 0; i < INVEN_TOTAL; i++) |
|---|
| 2749 | | { |
|---|
| 2750 | | o_ptr = &inventory[i]; |
|---|
| 2751 | | |
|---|
| 2752 | | /* Skip non-objects */ |
|---|
| 2753 | | if (!o_ptr->k_idx) continue; |
|---|
| 2754 | | |
|---|
| 2755 | | /* Aware and Known */ |
|---|
| 2756 | | object_aware(o_ptr); |
|---|
| 2757 | | object_known(o_ptr); |
|---|
| 2758 | | |
|---|
| 2759 | | /* Fully known */ |
|---|
| 2760 | | o_ptr->ident |= (IDENT_KNOWN); |
|---|
| 2761 | | } |
|---|
| 2762 | | |
|---|
| 2763 | | /* Hack -- Know everything in the home */ |
|---|
| 2764 | | for (i = 0; i < st_ptr->stock_num; i++) |
|---|
| 2765 | | { |
|---|
| 2766 | | o_ptr = &st_ptr->stock[i]; |
|---|
| 2767 | | |
|---|
| 2768 | | /* Skip non-objects */ |
|---|
| 2769 | | if (!o_ptr->k_idx) continue; |
|---|
| 2770 | | |
|---|
| 2771 | | /* Aware and Known */ |
|---|
| 2772 | | object_aware(o_ptr); |
|---|
| 2773 | | object_known(o_ptr); |
|---|
| 2774 | | |
|---|
| 2775 | | /* Fully known */ |
|---|
| 2776 | | o_ptr->ident |= (IDENT_KNOWN); |
|---|
| 2777 | | } |
|---|
| 2778 | | |
|---|
| 2779 | | /* Hack -- Recalculate bonuses */ |
|---|
| 2780 | | p_ptr->update |= (PU_BONUS); |
|---|
| 2781 | | |
|---|
| 2782 | | /* Handle stuff */ |
|---|
| 2783 | | handle_stuff(); |
|---|
| 2784 | | } |
|---|
| 2785 | | |
|---|
| 2786 | | |
|---|
| 2787 | | |
|---|
| 2788 | | /* |
|---|
| 2789 | | * Change the player into a Winner |
|---|
| 2790 | | */ |
|---|
| 2791 | | static void kingly(void) |
|---|
| 2792 | | { |
|---|
| 2793 | | /* Hack -- retire in town */ |
|---|
| 2794 | | p_ptr->depth = 0; |
|---|
| 2795 | | |
|---|
| 2796 | | /* Fake death */ |
|---|
| 2797 | | my_strcpy(p_ptr->died_from, "Ripe Old Age", sizeof(p_ptr->died_from)); |
|---|
| 2798 | | |
|---|
| 2799 | | /* Restore the experience */ |
|---|
| 2800 | | p_ptr->exp = p_ptr->max_exp; |
|---|
| 2801 | | |
|---|
| 2802 | | /* Restore the level */ |
|---|
| 2803 | | p_ptr->lev = p_ptr->max_lev; |
|---|
| 2804 | | |
|---|
| 2805 | | /* Hack -- Instant Gold */ |
|---|
| 2806 | | p_ptr->au += 10000000L; |
|---|
| 2807 | | |
|---|
| 2808 | | /* Clear screen */ |
|---|
| 2809 | | Term_clear(); |
|---|
| 2810 | | |
|---|
| 2811 | | /* Display a crown */ |
|---|
| 2812 | | put_str("#", 1, 34); |
|---|
| 2813 | | put_str("#####", 2, 32); |
|---|
| 2814 | | put_str("#", 3, 34); |
|---|
| 2815 | | put_str(",,, $$$ ,,,", 4, 28); |
|---|
| 2816 | | put_str(",,=$ \"$$$$$\" $=,,", 5, 24); |
|---|
| 2817 | | put_str(",$$ $$$ $$,", 6, 22); |
|---|
| 2818 | | put_str("*> <*> <*", 7, 22); |
|---|
| 2819 | | put_str("$$ $$$ $$", 8, 22); |
|---|
| 2820 | | put_str("\"$$ $$$ $$\"", 9, 22); |
|---|
| 2821 | | put_str("\"$$ $$$ $$\"", 10, 23); |
|---|
| 2822 | | put_str("*#########*#########*", 11, 24); |
|---|
| 2823 | | put_str("*#########*#########*", 12, 24); |
|---|
| 2824 | | |
|---|
| 2825 | | /* Display a message */ |
|---|
| 2826 | | put_str("Veni, Vidi, Vici!", 15, 26); |
|---|
| 2827 | | put_str("I came, I saw, I conquered!", 16, 21); |
|---|
| 2828 | | put_str(format("All Hail the Mighty %s!", sp_ptr->winner), 17, 22); |
|---|
| 2829 | | |
|---|
| 2830 | | /* Flush input */ |
|---|
| 2831 | | flush(); |
|---|
| 2832 | | |
|---|
| 2833 | | /* Wait for response */ |
|---|
| 2834 | | pause_line(Term->hgt - 1); |
|---|
| 2835 | | } |
|---|
| 2836 | | |
|---|
| 2837 | | |
|---|
| 2838 | | |
|---|
| 2839 | | |
|---|
| 2840 | | |
|---|
| 2841 | | |
|---|
| 2842 | | |
|---|
| 2843 | | static void death_file(void *unused, const char *title) |
|---|
| 2844 | | { |
|---|
| 2845 | | char ftmp[80]; |
|---|
| 2846 | | strnfmt(ftmp, sizeof(ftmp), "%s.txt", op_ptr->base_name); |
|---|
| 2847 | | |
|---|
| 2848 | | if (!get_string("File name: ", ftmp, sizeof(ftmp))) |
|---|
| 2849 | | return; |
|---|
| 2850 | | |
|---|
| 2851 | | if (ftmp[0] && (ftmp[0] != ' ')) |
|---|
| 2852 | | { |
|---|
| 2853 | | errr err; |
|---|
| 2854 | | |
|---|
| 2855 | | /* Dump a character file */ |
|---|
| 2856 | | screen_save(); |
|---|
| 2857 | | err = file_character(ftmp, FALSE); |
|---|
| 2858 | | screen_load(); |
|---|
| 2859 | | |
|---|
| 2860 | | /* Check result */ |
|---|
| 2861 | | if (err) |
|---|
| 2862 | | msg_print("Character dump failed!"); |
|---|
| 2863 | | else |
|---|
| 2864 | | msg_print("Character dump successful."); |
|---|
| 2865 | | |
|---|
| 2866 | | /* Flush messages */ |
|---|
| 2867 | | message_flush(); |
|---|
| 2868 | | } |
|---|
| 2869 | | } |
|---|
| 2870 | | |
|---|
| 2871 | | static void death_info(void *unused, const char *title) |
|---|
| 2872 | | { |
|---|
| 2873 | | int i, j, k; |
|---|
| 2874 | | object_type *o_ptr; |
|---|
| 2875 | | store_type *st_ptr = &store[STORE_HOME]; |
|---|
| 2876 | | |
|---|
| 2877 | | |
|---|
| 2878 | | screen_save(); |
|---|
| 2879 | | |
|---|
| 2880 | | /* Display player */ |
|---|
| 2881 | | display_player(0); |
|---|
| 2882 | | |
|---|
| 2883 | | /* Prompt for inventory */ |
|---|
| 2884 | | prt("Hit any key to see more information (ESC to abort): ", 23, 0); |
|---|
| 2885 | | |
|---|
| 2886 | | /* Allow abort at this point */ |
|---|
| 2887 | | if (inkey() == ESCAPE) return; |
|---|
| 2888 | | |
|---|
| 2889 | | |
|---|
| 2890 | | /* Show equipment and inventory */ |
|---|
| 2891 | | |
|---|
| 2892 | | /* Equipment -- if any */ |
|---|
| 2893 | | if (p_ptr->equip_cnt) |
|---|
| 2894 | | { |
|---|
| 2895 | | Term_clear(); |
|---|
| 2896 | | item_tester_full = TRUE; |
|---|
| 2897 | | show_equip(); |
|---|
| 2898 | | prt("You are using: -more-", 0, 0); |
|---|
| 2899 | | if (inkey() == ESCAPE) return; |
|---|
| 2900 | | } |
|---|
| 2901 | | |
|---|
| 2902 | | /* Inventory -- if any */ |
|---|
| 2903 | | if (p_ptr->inven_cnt) |
|---|
| 2904 | | { |
|---|
| 2905 | | Term_clear(); |
|---|
| 2906 | | item_tester_full = TRUE; |
|---|
| 2907 | | show_inven(); |
|---|
| 2908 | | prt("You are carrying: -more-", 0, 0); |
|---|
| 2909 | | if (inkey() == ESCAPE) return; |
|---|
| 2910 | | } |
|---|
| 2911 | | |
|---|
| 2912 | | |
|---|
| 2913 | | |
|---|
| 2914 | | /* Home -- if anything there */ |
|---|
| 2915 | | if (st_ptr->stock_num) |
|---|
| 2916 | | { |
|---|
| 2917 | | /* Display contents of the home */ |
|---|
| 2918 | | for (k = 0, i = 0; i < st_ptr->stock_num; k++) |
|---|
| 2919 | | { |
|---|
| 2920 | | /* Clear screen */ |
|---|
| 2921 | | Term_clear(); |
|---|
| 2922 | | |
|---|
| 2923 | | /* Show 12 items */ |
|---|
| 2924 | | for (j = 0; (j < 12) && (i < st_ptr->stock_num); j++, i++) |
|---|
| 2925 | | { |
|---|
| 2926 | | byte attr; |
|---|
| 2927 | | |
|---|
| 2928 | | char o_name[80]; |
|---|
| 2929 | | char tmp_val[80]; |
|---|
| 2930 | | |
|---|
| 2931 | | /* Get the object */ |
|---|
| 2932 | | o_ptr = &st_ptr->stock[i]; |
|---|
| 2933 | | |
|---|
| 2934 | | /* Print header, clear line */ |
|---|
| 2935 | | strnfmt(tmp_val, sizeof(tmp_val), "%c) ", I2A(j)); |
|---|
| 2936 | | prt(tmp_val, j+2, 4); |
|---|
| 2937 | | |
|---|
| 2938 | | /* Get the object description */ |
|---|
| 2939 | | object_desc(o_name, sizeof(o_name), o_ptr, TRUE, 3); |
|---|
| 2940 | | |
|---|
| 2941 | | /* Get the inventory color */ |
|---|
| 2942 | | attr = tval_to_attr[o_ptr->tval % N_ELEMENTS(tval_to_attr)]; |
|---|
| 2943 | | |
|---|
| 2944 | | /* Display the object */ |
|---|
| 2945 | | c_put_str(attr, o_name, j+2, 7); |
|---|
| 2946 | | } |
|---|
| 2947 | | |
|---|
| 2948 | | /* Caption */ |
|---|
| 2949 | | prt(format("Your home contains (page %d): -more-", k+1), 0, 0); |
|---|
| 2950 | | |
|---|
| 2951 | | /* Wait for it */ |
|---|
| 2952 | | if (inkey() == ESCAPE) return; |
|---|
| 2953 | | } |
|---|
| 2954 | | } |
|---|
| 2955 | | |
|---|
| 2956 | | screen_load(); |
|---|
| 2957 | | } |
|---|
| 2958 | | |
|---|
| 2959 | | static void death_messages(void *unused, const char *title) |
|---|
| 2960 | | { |
|---|
| 2961 | | screen_save(); |
|---|
| 2962 | | do_cmd_messages(); |
|---|
| 2963 | | screen_load(); |
|---|
| 2964 | | } |
|---|
| 2965 | | |
|---|
| 2966 | | static void death_scores(void *unused, const char *title) |
|---|
| 2967 | | { |
|---|
| 2968 | | screen_save(); |
|---|
| 2969 | | top_twenty(); |
|---|
| 2970 | | screen_load(); |
|---|
| 2971 | | } |
|---|
| 2972 | | |
|---|
| 2973 | | static void death_examine(void *unused, const char *title) |
|---|
| 2974 | | { |
|---|
| 2975 | | int item; |
|---|
| 2976 | | cptr q, s; |
|---|
| 2977 | | |
|---|
| 2978 | | |
|---|
| 2979 | | screen_save(); |
|---|
| 2980 | | Term_clear(); |
|---|
| 2981 | | |
|---|
| 2982 | | /* Start out in "display" mode */ |
|---|
| 2983 | | p_ptr->command_see = TRUE; |
|---|
| 2984 | | |
|---|
| 2985 | | /* Get an item */ |
|---|
| 2986 | | q = "Examine which item? "; |
|---|
| 2987 | | s = "You have nothing to examine."; |
|---|
| 2988 | | |
|---|
| 2989 | | while (get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) |
|---|
| 2990 | | { |
|---|
| 2991 | | object_type *o_ptr = &inventory[item]; |
|---|
| 2992 | | |
|---|
| 2993 | | /* "Know" */ |
|---|
| 2994 | | o_ptr->ident |= IDENT_KNOWN; |
|---|
| 2995 | | |
|---|
| 2996 | | /* Describe */ |
|---|
| 2997 | | text_out_hook = text_out_to_screen; |
|---|
| 2998 | | screen_save(); |
|---|
| 2999 | | Term_gotoxy(0, 0); |
|---|
| 3000 | | |
|---|
| 3001 | | object_info_header(o_ptr); |
|---|
| 3002 | | if (!object_info_known(o_ptr)) |
|---|
| 3003 | | text_out("This item does not possess any special abilities."); |
|---|
| 3004 | | |
|---|
| 3005 | | text_out_c(TERM_L_BLUE, "\n\n[Press any key to continue]\n"); |
|---|
| 3006 | | (void)anykey(); |
|---|
| 3007 | | |
|---|
| 3008 | | screen_load(); |
|---|
| 3009 | | } |
|---|
| 3010 | | |
|---|
| 3011 | | screen_load(); |
|---|
| 3012 | | } |
|---|
| 3013 | | |
|---|
| 3014 | | menu_type death_menu; |
|---|
| 3015 | | |
|---|
| 3016 | | static const menu_action death_actions[] = |
|---|
| 3017 | | { |
|---|
| 3018 | | { 'i', "Information", death_info, NULL }, |
|---|
| 3019 | | { 'm', "Messages", death_messages, NULL }, |
|---|
| 3020 | | { 'f', "File dump", death_file, NULL }, |
|---|
| 3021 | | { 'v', "View scores", death_scores, NULL }, |
|---|
| 3022 | | { 'x', "Examine items", death_examine, NULL }, |
|---|
| 3023 | | { 'q', "Quit", death_examine, NULL }, |
|---|
| 3024 | | }; |
|---|
| 3025 | | |
|---|
| 3026 | | |
|---|
| 3027 | | |
|---|
| 3028 | | |
|---|
| 3029 | | static char tag_death_main(menu_type *menu, int oid) |
|---|
| 3030 | | { |
|---|
| 3031 | | if (death_actions[oid].id) |
|---|
| 3032 | | return death_actions[oid].id; |
|---|
| 3033 | | |
|---|
| 3034 | | return 0; |
|---|
| 3035 | | } |
|---|
| 3036 | | |
|---|
| 3037 | | static int valid_death_main(menu_type *menu, int oid) |
|---|
| 3038 | | { |
|---|
| 3039 | | if (death_actions[oid].name) |
|---|
| 3040 | | return 1; |
|---|
| 3041 | | |
|---|
| 3042 | | return 0; |
|---|
| 3043 | | } |
|---|
| 3044 | | |
|---|
| 3045 | | static void display_death_main(menu_type *menu, int oid, bool cursor, int row, int col, int width) |
|---|
| 3046 | | { |
|---|
| 3047 | | byte attr = curs_attrs[CURS_KNOWN][(int)cursor]; |
|---|
| 3048 | | |
|---|
| 3049 | | if (death_actions[oid].name) |
|---|
| 3050 | | c_prt(attr, death_actions[oid].name, row, col); |
|---|
| 3051 | | } |
|---|
| 3052 | | |
|---|
| 3053 | | |
|---|
| 3054 | | static const menu_iter death_iter = |
|---|
| 3055 | | { |
|---|
| 3056 | | 0, |
|---|
| 3057 | | tag_death_main, |
|---|
| 3058 | | valid_death_main, |
|---|
| 3059 | | display_death_main, |
|---|
| 3060 | | NULL |
|---|
| 3061 | | }; |
|---|
| 3062 | | |
|---|
| 3063 | | |
|---|
| 3064 | | |
|---|
| 3065 | | |
|---|
| 3066 | | /* |
|---|
| 3067 | | * Handle character death |
|---|
| 3068 | | */ |
|---|
| 3069 | | static void close_game_aux(void) |
|---|
| 3070 | | { |
|---|
| 3071 | | bool wants_to_quit = FALSE; |
|---|
| 3072 | | |
|---|
| 3073 | | |
|---|
| 3074 | | /* Handle retirement */ |
|---|
| 3075 | | if (p_ptr->total_winner) kingly(); |
|---|
| 3076 | | |
|---|
| 3077 | | /* Save dead player */ |
|---|
| 3078 | | if (new_save ? !save(savefile) : !old_save()) |
|---|
| 3079 | | { |
|---|
| 3080 | | msg_print("death save failed!"); |
|---|
| 3081 | | message_flush(); |
|---|
| 3082 | | } |
|---|
| 3083 | | |
|---|
| 3084 | | /* Get time of death */ |
|---|
| 3085 | | (void)time(&death_time); |
|---|
| 3086 | | |
|---|
| 3087 | | /* You are dead */ |
|---|
| 3088 | | print_tomb(); |
|---|
| 3089 | | |
|---|
| 3090 | | /* Hack - Know everything upon death */ |
|---|
| 3091 | | death_knowledge(); |
|---|
| 3092 | | |
|---|
| 3093 | | /* Enter player in high score list */ |
|---|
| 3094 | | enter_score(&death_time); |
|---|
| 3095 | | |
|---|
| 3096 | | /* Flush all input keys */ |
|---|
| 3097 | | flush(); |
|---|
| 3098 | | |
|---|
| 3099 | | /* Flush messages */ |
|---|
| 3100 | | message_flush(); |
|---|
| 3101 | | |
|---|
| 3102 | | |
|---|
| 3103 | | /* Initialize the menus */ |
|---|
| 3104 | | menu_type *menu; |
|---|
| 3105 | | const char cmd_keys[] = { ARROW_LEFT, ARROW_RIGHT, '\0' }; |
|---|
| 3106 | | const region area = { 51, 2, 0, 6 }; |
|---|
| 3107 | | |
|---|
| 3108 | | int cursor = 0; |
|---|
| 3109 | | ui_event_data c = EVENT_EMPTY; |
|---|
| 3110 | | |
|---|
| 3111 | | |
|---|
| 3112 | | /* options screen selection menu */ |
|---|
| 3113 | | menu = &death_menu; |
|---|
| 3114 | | WIPE(menu, menu_type); |
|---|
| 3115 | | menu_set_id(menu, 1); |
|---|
| 3116 | | menu->menu_data = death_actions; |
|---|
| 3117 | | menu->flags = MN_CASELESS_TAGS; |
|---|
| 3118 | | menu->cmd_keys = cmd_keys; |
|---|
| 3119 | | menu->count = N_ELEMENTS(death_actions); |
|---|
| 3120 | | |
|---|
| 3121 | | menu_init2(menu, find_menu_skin(MN_SCROLL), &death_iter, &area); |
|---|
| 3122 | | |
|---|
| 3123 | | while (TRUE) |
|---|
| 3124 | | { |
|---|
| 3125 | | c = menu_select(&death_menu, &cursor, 0); |
|---|
| 3126 | | |
|---|
| 3127 | | if (c.key == ESCAPE || cursor == 5) |
|---|
| 3128 | | { |
|---|
| 3129 | | if (get_check("Do you want to quit? ")) |
|---|
| 3130 | | break; |
|---|
| 3131 | | } |
|---|
| 3132 | | else if (c.type == EVT_SELECT && death_actions[cursor].action) |
|---|
| 3133 | | { |
|---|
| 3134 | | death_actions[cursor].action(death_actions[cursor].data, NULL); |
|---|
| 3135 | | } |
|---|
| 3136 | | } |
|---|
| 3137 | | } |
|---|
| 3138 | | |
|---|
| 3139 | | |
|---|
| 3140 | | /* |
|---|