00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00023
00024 #include "crogue.h"
00025 #include "export.h"
00026
00027 #ifdef KEY_SCROLLING
00028 # define KEY_SCROLLING_ACTIONS 1
00029 #else
00030 # define KEY_SCROLLING_ACTIONS 0
00031 #endif
00032 #ifdef ALLOWDEBUG
00033 # define DEBUG_ACTIONS 1
00034 #else
00035 # define DEBUG_ACTIONS 0
00036 #endif
00037
00038
00040 typedef struct actions_menu_entry
00041 {
00042 const char *str;
00043 int key;
00044 } actions_menu_entry;
00045
00046 static const actions_menu_entry actions[] =
00047 {
00048 { gettext("Walk left"), KEY_WEST },
00049 { gettext("Run left"), KEY_RUN_WEST },
00050 #ifdef KEY_SCROLLING
00051 { gettext("Scroll view left"), KEY_SCROLL_LEFT },
00052 #endif
00053 { gettext("Wait"), KEY_WAIT },
00054 { gettext("Climb stairs"), KEY_STAIR },
00055 { gettext("Show inventory"), KEY_INVENTORY },
00056 { gettext("Fire readied ammo"), KEY_FIRE },
00057 { gettext("Cast spell"), KEY_CAST },
00058 { gettext("Use item"), KEY_USE },
00059 { gettext("Equip item"), KEY_WEAR },
00060 { gettext("Equip items"), KEY_WEAR_MULTIPLE },
00061 { gettext("Take off item"), KEY_TAKEOFF },
00062 { gettext("Take off items"), KEY_TAKEOFF_MULTIPLE },
00063 { gettext("Drop item"), KEY_DROP },
00064 { gettext("Drop items"), KEY_DROP_MULTIPLE },
00065 { gettext("Pick up items"), KEY_PICKUP },
00066 { gettext("Throw item"), KEY_THROW },
00067 { gettext("Show message history"), KEY_MESSAGE_HISTORY },
00068 { gettext("Show known item types"), KEY_DISCOVERIES },
00069 { gettext("Search"), KEY_SEARCH },
00070 { gettext("Open door"), KEY_OPENDOOR },
00071 { gettext("Close door"), KEY_CLOSEDOOR },
00072 { gettext("Options"), KEY_OPTIONS_MENU },
00073 { gettext("Help"), KEY_HELPMENU },
00074 { gettext("Character info"), KEY_STATS },
00075 { gettext("About"), KEY_ABOUT },
00076 #ifdef ALLOWDEBUG
00077 { gettext("Debug"), KEY_DEBUG },
00078 #endif
00079 { gettext("Hotkey item"), KEY_HOTKEY_ITEM },
00080 { gettext("Redraw screen"), KEY_REDRAW },
00081 { gettext("Quit"), KEY_ESC },
00082 { gettext("Save game"), KEY_SAVEGAME },
00083 { NULL, 0 }
00084 };
00085
00086 static void actions_menu_callback(int n, char *buf)
00087 {
00088 sprintf(buf, "%s\t%s", actions[n].str, get_keyname(actions[n].key));
00089 }
00090
00093 static int num_actions(void)
00094 {
00095 int ii;
00096 for(ii=0; ; ii++) {
00097 if(actions[ii].str == NULL)
00098 return ii;
00099 }
00100 }
00101
00102 int actions_menu(void)
00103 {
00104 int ret;
00105 setTabStops(actions_menu_tab_stops);
00106 ret = UI_Menu_Pick( actions_rect, num_actions(), &actions_menu_callback, 0 );
00107 full_redraw();
00108 if(ret<0)
00109 return KEY_NOP;
00110 return actions[ret].key;
00111 }
00112
00113