Changeset 112

Show
Ignore:
Timestamp:
05/05/07 19:16:57 (1 year ago)
Author:
takkaria
Message:
  • Move player skills into an array (cleans up some files.c code)
  • Nuke (virtually) unused move_cursor function
  • Convert command list into a struct; WIP but works. Part of #9
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/cmd1.c

    r69 r112  
    419419 
    420420        /* Start with base search ability */ 
    421         chance = p_ptr->skill_srh
     421        chance = p_ptr->skills[SKILL_SRH]
    422422 
    423423        /* Penalize various conditions */ 
     
    11571157        /* Calculate the "attack quality" */ 
    11581158        bonus = p_ptr->to_h + o_ptr->to_h; 
    1159         chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ)); 
     1159        chance = (p_ptr->skills[SKILL_THN] + (bonus * BTH_PLUS_ADJ)); 
    11601160 
    11611161 
     
    13771377 
    13781378                /* Spontaneous Searching */ 
    1379                 if ((p_ptr->skill_fos >= 50) || 
    1380                     (0 == rand_int(50 - p_ptr->skill_fos))) 
     1379                if ((p_ptr->skills[SKILL_FOS] >= 50) || 
     1380                    (0 == rand_int(50 - p_ptr->skills[SKILL_FOS]))) 
    13811381                { 
    13821382                        search(); 
  • trunk/src/cmd2.c

    r69 r112  
    354354 
    355355                /* Get the "disarm" factor */ 
    356                 i = p_ptr->skill_dis
     356                i = p_ptr->skills[SKILL_DIS]
    357357 
    358358                /* Penalize some conditions */ 
     
    423423 
    424424        /* Get the "disarm" factor */ 
    425         i = p_ptr->skill_dis
     425        i = p_ptr->skills[SKILL_DIS]
    426426 
    427427        /* Penalize some conditions */ 
     
    673673        { 
    674674                /* Disarm factor */ 
    675                 i = p_ptr->skill_dis
     675                i = p_ptr->skills[SKILL_DIS]
    676676 
    677677                /* Penalize some conditions */ 
     
    10891089        { 
    10901090                /* Tunnel */ 
    1091                 if ((p_ptr->skill_dig > 40 + rand_int(1600)) && twall(y, x)) 
     1091                if ((p_ptr->skills[SKILL_DIG] > 40 + rand_int(1600)) && twall(y, x)) 
    10921092                { 
    10931093                        msg_print("You have finished the tunnel."); 
     
    11251125                if (hard) 
    11261126                { 
    1127                         okay = (p_ptr->skill_dig > 20 + rand_int(800)); 
     1127                        okay = (p_ptr->skills[SKILL_DIG] > 20 + rand_int(800)); 
    11281128                } 
    11291129 
     
    11311131                else 
    11321132                { 
    1133                         okay = (p_ptr->skill_dig > 10 + rand_int(400)); 
     1133                        okay = (p_ptr->skills[SKILL_DIG] > 10 + rand_int(400)); 
    11341134                } 
    11351135 
     
    11761176        { 
    11771177                /* Remove the rubble */ 
    1178                 if ((p_ptr->skill_dig > rand_int(200)) && twall(y, x)) 
     1178                if ((p_ptr->skills[SKILL_DIG] > rand_int(200)) && twall(y, x)) 
    11791179                { 
    11801180                        /* Message */ 
     
    12071207        { 
    12081208                /* Tunnel */ 
    1209                 if ((p_ptr->skill_dig > 30 + rand_int(1200)) && twall(y, x)) 
     1209                if ((p_ptr->skills[SKILL_DIG] > 30 + rand_int(1200)) && twall(y, x)) 
    12101210                { 
    12111211                        msg_print("You have finished the tunnel."); 
     
    12281228        { 
    12291229                /* Tunnel */ 
    1230                 if ((p_ptr->skill_dig > 30 + rand_int(1200)) && twall(y, x)) 
     1230                if ((p_ptr->skills[SKILL_DIG] > 30 + rand_int(1200)) && twall(y, x)) 
    12311231                { 
    12321232                        msg_print("You have finished the tunnel."); 
     
    13741374 
    13751375        /* Get the "disarm" factor */ 
    1376         i = p_ptr->skill_dis
     1376        i = p_ptr->skills[SKILL_DIS]
    13771377 
    13781378        /* Penalize some conditions */ 
     
    22052205 
    22062206        /* Spontaneous Searching */ 
    2207         if ((p_ptr->skill_fos >= 50) || (0 == rand_int(50 - p_ptr->skill_fos))) 
     2207        if ((p_ptr->skills[SKILL_FOS] >= 50) || (0 == rand_int(50 - p_ptr->skills[SKILL_FOS]))) 
    22082208        { 
    22092209                search(); 
     
    25122512        /* Actually "fire" the object */ 
    25132513        bonus = (p_ptr->to_h + i_ptr->to_h + j_ptr->to_h); 
    2514         chance = (p_ptr->skill_thb + (bonus * BTH_PLUS_ADJ)); 
     2514        chance = (p_ptr->skills[SKILL_THB] + (bonus * BTH_PLUS_ADJ)); 
    25152515 
    25162516        /* Assume a base multiplier */ 
     
    28112811 
    28122812        /* Chance of hitting */ 
    2813         chance = (p_ptr->skill_tht + (p_ptr->to_h * BTH_PLUS_ADJ)); 
     2813        chance = (p_ptr->skills[SKILL_THT] + (p_ptr->to_h * BTH_PLUS_ADJ)); 
    28142814 
    28152815 
  • trunk/src/cmd4.c

    r111 r112  
    490490                        prt( "Group", 4, 0); 
    491491                        prt("Name", 4, g_name_len + 3); 
    492                         move_cursor(4, 65); 
     492                        Term_gotoxy(65, 4); 
    493493                        if(o_funcs.note) 
    494494                                Term_addstr(-1, TERM_WHITE, "Inscribed "); 
  • trunk/src/cmd6.c

    r24 r112  
    390390 
    391391        /* Base chance of success */ 
    392         chance = p_ptr->skill_dev
     392        chance = p_ptr->skills[SKILL_DEV]
    393393 
    394394        /* Confusion hurts skill */ 
     
    695695 
    696696        /* Base chance of success */ 
    697         chance = p_ptr->skill_dev
     697        chance = p_ptr->skills[SKILL_DEV]
    698698 
    699699        /* Confusion hurts skill */ 
  • trunk/src/defines.h

    r110 r112  
    444444 
    445445 
     446/*** Constants for accessing the player struct ***/ 
     447 
    446448/* 
    447449 * Timed effects 
     
    456458 
    457459        TMD_MAX 
     460}; 
     461 
     462/* 
     463 * Skill indexes 
     464 */ 
     465enum 
     466{ 
     467        SKILL_DIS,      /* Skill: Disarming */ 
     468        SKILL_DEV,      /* Skill: Magic Devices */ 
     469        SKILL_SAV,      /* Skill: Saving throw */ 
     470        SKILL_STL,      /* Skill: Stealth factor */ 
     471        SKILL_SRH,      /* Skill: Searching ability */ 
     472        SKILL_FOS,      /* Skill: Searching frequency */ 
     473        SKILL_THN,      /* Skill: To hit (normal) */ 
     474        SKILL_THB,      /* Skill: To hit (shooting) */ 
     475        SKILL_THT,      /* Skill: To hit (throwing) */ 
     476        SKILL_DIG,      /* Skill: Digging */ 
     477 
     478        SKILL_MAX 
    458479}; 
    459480 
  • trunk/src/dungeon.c

    r91 r112  
    11061106 
    11071107 
     1108/* 
     1109 * Toggle wizard mode 
     1110 */ 
     1111static void do_cmd_toggle_wizard(void) 
     1112{ 
     1113        if (p_ptr->wizard) 
     1114        { 
     1115                p_ptr->wizard = FALSE; 
     1116                msg_print("Wizard mode off."); 
     1117        } 
     1118        else if (enter_wizard_mode()) 
     1119        { 
     1120                p_ptr->wizard = TRUE; 
     1121                msg_print("Wizard mode on."); 
     1122        } 
     1123 
     1124        /* Update monsters */ 
     1125        p_ptr->update |= (PU_MONSTERS); 
     1126 
     1127        /* Redraw "title" */ 
     1128        p_ptr->redraw |= (PR_TITLE); 
     1129} 
     1130 
     1131#ifdef ALLOW_DEBUG 
     1132 
     1133static void do_cmd_do_debug(void) 
     1134{ 
     1135        if (verify_debug_mode()) do_cmd_debug(); 
     1136} 
     1137 
     1138#endif 
     1139 
     1140#ifdef ALLOW_BORG 
     1141 
     1142static void do_cmd_do_borg(void) 
     1143{ 
     1144        if (verify_borg_mode()) do_cmd_borg(); 
     1145} 
     1146 
     1147#endif 
     1148 
     1149static void do_cmd_cast_or_pray(void) 
     1150{ 
     1151        if (cp_ptr->spell_book == TV_PRAYER_BOOK) 
     1152                do_cmd_pray(); 
     1153        else 
     1154                do_cmd_cast(); 
     1155} 
     1156 
     1157static void do_cmd_quit(void) 
     1158{ 
     1159        /* Stop playing */ 
     1160        p_ptr->playing = FALSE; 
     1161 
     1162        /* Leaving */ 
     1163        p_ptr->leaving = TRUE; 
     1164} 
     1165 
     1166static void do_cmd_mouseclick(void) 
     1167{ 
     1168        int x, y; 
     1169 
     1170        x = p_ptr->command_cmd_ex.mousex - COL_MAP; 
     1171        if (use_bigtile) x /= 2; 
     1172        x += Term->offset_x; 
     1173        y = p_ptr->command_cmd_ex.mousey - ROW_MAP + Term->offset_y; 
     1174 
     1175        if (x < 0 || y < 0) 
     1176                return; 
     1177 
     1178        do_cmd_pathfind(y, x); 
     1179} 
     1180 
     1181static void do_cmd_port(void) 
     1182{ 
     1183        (void)Term_user(0); 
     1184} 
     1185 
     1186static void do_cmd_xxx_options(void) 
     1187{ 
     1188        do_cmd_options(); 
     1189        do_cmd_redraw(); 
     1190} 
     1191 
     1192/* 
     1193 * Useful typedef. 
     1194 */ 
     1195typedef void do_cmd_type(void); 
     1196 
     1197/* 
     1198 * List of all commands and their descriptions. 
     1199 */ 
     1200static const struct 
     1201{ 
     1202        const char *desc; 
     1203        unsigned char key; 
     1204        do_cmd_type *hook; 
     1205} commands[] = 
     1206{ 
     1207 
     1208        /*** Cheating commands ***/ 
     1209 
     1210        { "Toggle wizard mode",  KTRL('W'), do_cmd_toggle_wizard }, 
     1211 
     1212#ifdef ALLOW_DEBUG 
     1213        { "Debug mode commands", KTRL('A'), do_cmd_do_debug }, 
     1214#endif 
     1215#ifdef ALLOW_BORG 
     1216        { "Borg commands",       KTRL('Z'), do_cmd_do_borg }, 
     1217#endif 
     1218 
     1219 
     1220        /*** Inventory commands ***/ 
     1221 
     1222        { "Display equipment listing", 'e', do_cmd_equip }, 
     1223        { "Display inventory listing", 'i', do_cmd_inven }, 
     1224        { "Toggle windows",      KTRL('E'), toggle_inven_equip }, /* XXX */ 
     1225 
     1226 
     1227        /*** Movement commands ***/ 
     1228 
     1229        { "Alter a grid",  '+', do_cmd_alter }, 
     1230        { "Dig a tunnel",  'T', do_cmd_tunnel }, 
     1231        { "Walk",          ';', do_cmd_walk }, 
     1232        { "Jump",          '-', do_cmd_jump }, 
     1233 
     1234 
     1235        /*** Running, Resting, Searching, Staying */ 
     1236 
     1237        { "Start running",          '.', do_cmd_run }, 
     1238        { "Hold still for a turn",  ',', do_cmd_hold }, 
     1239        { "Stay still for a turn",  'g', do_cmd_stay }, 
     1240        { "Rest for a while",       'R', do_cmd_rest }, 
     1241        { "Search for traps/doors", 's', do_cmd_search }, 
     1242        { "Toggle search mode",     'S', do_cmd_toggle_search }, 
     1243 
     1244 
     1245        /*** Stairs and Doors and Chests and Traps ***/ 
     1246 
     1247        { "Enter a store",          '_', do_cmd_store }, 
     1248        { "Go up staircase",        '<', do_cmd_go_up }, 
     1249        { "Go down staircase",      '>', do_cmd_go_down }, 
     1250        { "Open a door or a chest", 'o', do_cmd_open }, 
     1251        { "Close a door",           'c', do_cmd_close }, 
     1252        { "Jam a door shut",        'j', do_cmd_spike }, 
     1253        { "Bash a door open",       'B', do_cmd_bash }, 
     1254        { "Disarm a trap or chest", 'D', do_cmd_disarm }, 
     1255 
     1256 
     1257        /*** Magic and Prayers ***/ 
     1258 
     1259        { "Gain new spells or prayers", 'G', do_cmd_study }, 
     1260        { "Browse a book",              'b', do_cmd_browse }, 
     1261        { "Cast a spell",               'm', do_cmd_cast_or_pray }, 
     1262        { "Pray a prayer",              'p', do_cmd_cast_or_pray }, 
     1263 
     1264 
     1265        /*** Use various objects ***/ 
     1266 
     1267        { "Wear/wield an item",       'w', do_cmd_wield }, 
     1268        { "Take/unwield off an item", 't', do_cmd_takeoff }, 
     1269        { "Drop an item",             'd', do_cmd_drop }, 
     1270        { "Destroy an item",          'k', do_cmd_destroy }, 
     1271        { "Examine an item",          'I', do_cmd_observe }, 
     1272        { "Inscribe an object",       '{', do_cmd_inscribe }, 
     1273        { "Uninscribe an object",     '}', do_cmd_uninscribe }, 
     1274        { "Activate an object",       'A', do_cmd_activate }, 
     1275        { "Eat some food",            'E', do_cmd_eat_food }, 
     1276        { "Fuel your light source",   'F', do_cmd_refill }, 
     1277        { "Fire your missile weapon", 'f', do_cmd_fire }, 
     1278        { "Throw an item",            'v', do_cmd_throw }, 
     1279        { "Aim a wand",               'a', do_cmd_aim_wand }, 
     1280        { "Zap a rod",                'z', do_cmd_zap_rod }, 
     1281        { "Quaff a potion",           'q', do_cmd_quaff_potion }, 
     1282        { "Read a scroll",            'r', do_cmd_read_scroll }, 
     1283        { "Use a staff",              'u', do_cmd_use_staff }, 
     1284 
     1285 
     1286        /*** Looking at Things (nearby or on map) ***/ 
     1287 
     1288        { "Full dungeon map",           'M', do_cmd_view_map }, 
     1289        { "Locate player on map",       'L', do_cmd_locate }, 
     1290        { "Look around",                'l', do_cmd_look }, 
     1291        { "Target monster or location", '*', do_cmd_target }, 
     1292 
     1293 
     1294        /*** Help and Such ***/ 
     1295 
     1296        { "Help",                  '?', do_cmd_help }, 
     1297        { "Identify symbol",       '/', do_cmd_query_symbol }, 
     1298        { "Character description", 'C', do_cmd_change_name }, 
     1299 
     1300 
     1301        /*** System Commands ***/ 
     1302 
     1303        { "Load a single pref line",   '"', do_cmd_pref }, 
     1304        { "Interact with options",     '=', do_cmd_xxx_options }, 
     1305        { "Port-specific preferences", '!', do_cmd_port }, 
     1306        { "Check knowledge",           '~', do_cmd_knowledge }, 
     1307        { "Check knowledge",           '|', do_cmd_knowledge }, 
     1308 
     1309 
     1310        /*** Misc Commands ***/ 
     1311 
     1312        { "Take notes",                   ':', do_cmd_note }, 
     1313        { "Version info",                 'V', do_cmd_version }, 
     1314        { "Repeat level feeling",   KTRL('F'), do_cmd_feeling }, 
     1315        { "Show previous message",  KTRL('O'), do_cmd_message_one }, 
     1316        { "Show previous messages", KTRL('P'), do_cmd_messages }, 
     1317        { "Redraw the screen",      KTRL('R'), do_cmd_redraw }, 
     1318        { "Save and don't quit",    KTRL('S'), do_cmd_save_game }, 
     1319        { "Save and quit",          KTRL('X'), do_cmd_quit }, 
     1320        { "Quit (commit suicide)",        'Q', do_cmd_suicide }, 
     1321 
     1322        { "Load \"screen dump\"", '(', do_cmd_load_screen }, 
     1323        { "Save \"screen dump\"", ')', do_cmd_save_screen }, 
     1324        { "Mouse click",       '\xff', do_cmd_mouseclick } 
     1325}; 
     1326 
     1327 
     1328/* List indexed by char */ 
     1329do_cmd_type *converted_list[UCHAR_MAX]; 
     1330 
     1331 
     1332static void do_cmd_unknown(void) 
     1333{ 
     1334        prt("Type '?' for help.", 0, 0); 
     1335} 
    11081336 
    11091337/* 
     
    11131341static void process_command(void) 
    11141342{ 
     1343        static bool first = TRUE; 
     1344 
    11151345#ifdef ALLOW_REPEAT 
    11161346 
     
    11201350#endif /* ALLOW_REPEAT */ 
    11211351 
    1122         /* Parse the command */ 
    1123         switch (p_ptr->command_cmd) 
    1124         { 
    1125                 /* Ignore */ 
    1126                 case ESCAPE: 
    1127                 case ' ': 
    1128                 case '\n': 
    1129                 case '\r': 
    1130                 case '\a': 
    1131                 { 
    1132                         break; 
    1133                 } 
    1134  
    1135  
    1136                 /*** Cheating Commands ***/ 
    1137  
    1138                 /* Toggle Wizard Mode */ 
    1139                 case KTRL('W'): 
    1140                 { 
    1141                         if (p_ptr->wizard) 
    1142                         { 
    1143                                 p_ptr->wizard = FALSE; 
    1144                                 msg_print("Wizard mode off."); 
    1145                         } 
    1146                         else if (enter_wizard_mode()) 
    1147                         { 
    1148                                 p_ptr->wizard = TRUE; 
    1149                                 msg_print("Wizard mode on."); 
    1150                         } 
    1151  
    1152                         /* Update monsters */ 
    1153                         p_ptr->update |= (PU_MONSTERS); 
    1154  
    1155                         /* Redraw "title" */ 
    1156                         p_ptr->redraw |= (PR_TITLE); 
    1157  
    1158                         break; 
    1159                 } 
    1160  
    1161  
    1162 #ifdef ALLOW_DEBUG 
    1163  
    1164                 /* Special "debug" commands */ 
    1165                 case KTRL('A'): 
    1166                 { 
    1167                         if (verify_debug_mode()) do_cmd_debug(); 
    1168                         break; 
    1169                 } 
    1170  
    1171 #endif 
    1172  
    1173  
    1174 #ifdef ALLOW_BORG 
    1175  
    1176                 /* Special "borg" commands */ 
    1177                 case KTRL('Z'): 
    1178                 { 
    1179                         if (verify_borg_mode()) do_cmd_borg(); 
    1180                         break; 
    1181                 } 
    1182  
    1183 #endif 
    1184  
    1185  
    1186  
    1187                 /*** Inventory Commands ***/ 
    1188  
    1189                 /* Wear/wield equipment */ 
    1190                 case 'w': 
    1191                 { 
    1192                         do_cmd_wield(); 
    1193                         break; 
    1194                 } 
    1195  
    1196                 /* Take off equipment */ 
    1197                 case 't': 
    1198                 { 
    1199                         do_cmd_takeoff(); 
    1200                         break; 
    1201                 } 
    1202  
    1203                 /* Drop an item */ 
    1204                 case 'd': 
    1205                 { 
    1206                         do_cmd_drop(); 
    1207                         break; 
    1208                 } 
    1209  
    1210                 /* Destroy an item */ 
    1211                 case 'k': 
    1212                 { 
    1213                         do_cmd_destroy(); 
    1214                         break; 
    1215                 } 
    1216  
    1217                 /* Equipment list */ 
    1218                 case 'e': 
    1219                 { 
    1220                         do_cmd_equip(); 
    1221                         break; 
    1222                 } 
    1223  
    1224                 /* Inventory list */ 
    1225                 case 'i': 
    1226                 { 
    1227                         do_cmd_inven(); 
    1228                         break; 
    1229                 } 
    1230  
    1231  
    1232                 /*** Various commands ***/ 
    1233  
    1234                 /* Identify an object */ 
    1235                 case 'I': 
    1236                 { 
    1237                         do_cmd_observe(); 
    1238                         break; 
    1239                 } 
    1240  
    1241                 /* Hack -- toggle windows */ 
    1242                 case KTRL('E'): 
    1243                 { 
    1244                         toggle_inven_equip(); 
    1245                         break; 
    1246                 } 
    1247  
    1248  
    1249                 /*** Standard "Movement" Commands ***/ 
    1250  
    1251                 /* Alter a grid */ 
    1252                 case '+': 
    1253                 { 
    1254                         do_cmd_alter(); 
    1255                         break; 
    1256                 } 
    1257  
    1258                 /* Dig a tunnel */ 
    1259                 case 'T': 
    1260                 { 
    1261                         do_cmd_tunnel(); 
    1262                         break; 
    1263                 } 
    1264  
    1265                 /* Walk */ 
    1266                 case ';': 
    1267                 { 
    1268                         do_cmd_walk(); 
    1269                         break; 
    1270                 } 
    1271  
    1272                 /* Jump */ 
    1273                 case '-': 
    1274                 { 
    1275                         do_cmd_jump(); 
    1276                         break; 
    1277                 } 
    1278  
    1279  
    1280                 /*** Running, Resting, Searching, Staying */ 
    1281  
    1282                 /* Begin Running -- Arg is Max Distance */ 
    1283                 case '.': 
    1284                 { 
    1285                         do_cmd_run(); 
    1286                         break; 
    1287                 } 
    1288  
    1289                 /* Hold still */ 
    1290                 case ',': 
    1291                 { 
    1292                         do_cmd_hold(); 
    1293                         break; 
    1294                 } 
    1295  
    1296                 /* Stay still */ 
    1297                 case 'g': 
    1298                 { 
    1299                         do_cmd_stay(); 
    1300                         break; 
    1301                 } 
    1302  
    1303                 /* Rest -- Arg is time */ 
    1304                 case 'R': 
    1305                 { 
    1306                         do_cmd_rest(); 
    1307                         break; 
    1308                 } 
    1309  
    1310                 /* Search for traps/doors */ 
    1311                 case 's': 
    1312                 { 
    1313                         do_cmd_search(); 
    1314                         break; 
    1315                 } 
    1316  
    1317                 /* Toggle search mode */ 
    1318                 case 'S': 
    1319                 { 
    1320                         do_cmd_toggle_search(); 
    1321                         break; 
    1322                 } 
    1323  
    1324  
    1325                 /*** Stairs and Doors and Chests and Traps ***/ 
    1326  
    1327                 /* Enter store */ 
    1328                 case '_': 
    1329                 { 
    1330                         do_cmd_store(); 
    1331                         break; 
    1332                 } 
    1333  
    1334                 /* Go up staircase */ 
    1335                 case '<': 
    1336                 { 
    1337                         do_cmd_go_up(); 
    1338                         break; 
    1339                 } 
    1340  
    1341                 /* Go down staircase */ 
    1342                 case '>': 
    1343                 { 
    1344                         do_cmd_go_down(); 
    1345                         break; 
    1346                 } 
    1347  
    1348                 /* Open a door or chest */ 
    1349                 case 'o': 
    1350                 { 
    1351                         do_cmd_open(); 
    1352                         break; 
    1353                 } 
    1354  
    1355                 /* Close a door */ 
    1356                 case 'c': 
    1357                 { 
    1358                         do_cmd_close(); 
    1359                         break; 
    1360                 } 
    1361  
    1362                 /* Jam a door with spikes */ 
    1363                 case 'j': 
    1364                 { 
    1365                         do_cmd_spike(); 
    1366                         break; 
    1367                 } 
    1368  
    1369                 /* Bash a door */ 
    1370                 case 'B': 
    1371                 { 
    1372                         do_cmd_bash(); 
    1373                         break; 
    1374                 } 
    1375  
    1376                 /* Disarm a trap or chest */ 
    1377                 case 'D': 
    1378                 { 
    1379                         do_cmd_disarm(); 
    1380                         break; 
    1381                 } 
    1382  
    1383  
    1384                 /*** Magic and Prayers ***/ 
    1385  
    1386                 /* Gain new spells/prayers */ 
    1387                 case 'G': 
    1388                 { 
    1389                         do_cmd_study(); 
    1390                         break; 
    1391                 } 
    1392  
    1393                 /* Browse a book */ 
    1394                 case 'b': 
    1395                 { 
    1396                         do_cmd_browse(); 
    1397                         break; 
    1398                 } 
    1399  
    1400                 /* Cast a spell */ 
    1401                 case 'm': 
    1402                 { 
    1403                         if (cp_ptr->spell_book == TV_PRAYER_BOOK) 
    1404                                 do_cmd_pray(); 
    1405                         else 
    1406                                 do_cmd_cast(); 
    1407  
    1408                         break; 
    1409                 } 
    1410  
    1411                 /* Pray a prayer */ 
    1412                 case 'p': 
    1413                 { 
    1414                         if (cp_ptr->spell_book == TV_MAGIC_BOOK) 
    1415                                 do_cmd_cast(); 
    1416                         else 
    1417                                 do_cmd_pray(); 
    1418  
    1419                         break; 
    1420                 } 
    1421  
    1422  
    1423                 /*** Use various objects ***/ 
    1424  
    1425                 /* Inscribe an object */ 
    1426                 case '{': 
    1427                 { 
    1428                         do_cmd_inscribe(); 
    1429                         break; 
    1430                 } 
    1431  
    1432                 /* Uninscribe an object */ 
    1433                 case '}': 
    1434                 { 
    1435                         do_cmd_uninscribe(); 
    1436                         break; 
    1437                 } 
    1438  
    1439                 /* Activate an artifact */ 
    1440                 case 'A': 
    1441                 { 
    1442                         do_cmd_activate(); 
    1443                         break; 
    1444                 } 
    1445  
    1446                 /* Eat some food */ 
    1447                 case 'E': 
    1448                 { 
    1449                         do_cmd_eat_food(); 
    1450                         break; 
    1451                 } 
    1452  
    1453                 /* Fuel your lantern/torch */ 
    1454                 case 'F': 
    1455                 { 
    1456                         do_cmd_refill(); 
    1457                         break; 
    1458                 } 
    1459  
    1460                 /* Fire an item */ 
    1461                 case 'f': 
    1462                 { 
    1463                         do_cmd_fire(); 
    1464                         break; 
    1465                 } 
    1466  
    1467                 /* Throw an item */ 
    1468                 case 'v': 
    1469                 { 
    1470                         do_cmd_throw(); 
    1471                         break; 
    1472                 } 
    1473  
    1474                 /* Aim a wand */ 
    1475                 case 'a': 
    1476                 { 
    1477                         do_cmd_aim_wand(); 
    1478                         break; 
    1479                 } 
    1480  
    1481                 /* Zap a rod */ 
    1482                 case 'z': 
    1483                 { 
    1484                         do_cmd_zap_rod(); 
    1485                         break; 
    1486                 } 
    1487  
    1488                 /* Quaff a potion */ 
    1489                 case 'q': 
    1490                 { 
    1491                         do_cmd_quaff_potion(); 
    1492                         break; 
    1493                 } 
    1494  
    1495                 /* Read a scroll */ 
    1496                 case 'r': 
    1497                 { 
    1498                         do_cmd_read_scroll(); 
    1499                         break; 
    1500                 } 
    1501  
    1502                 /* Use a staff */ 
    1503                 case 'u': 
    1504                 { 
    1505                         do_cmd_use_staff(); 
    1506                         break; 
    1507                 } 
    1508  
    1509  
    1510                 /*** Looking at Things (nearby or on map) ***/ 
    1511  
    1512                 /* Full dungeon map */ 
    1513                 case 'M': 
    1514                 { 
    1515                         do_cmd_view_map(); 
    1516                         break; 
    1517                 } 
    1518  
    1519                 /* Locate player on map */ 
    1520                 case 'L': 
    1521                 { 
    1522                         do_cmd_locate(); 
    1523                         break; 
    1524                 } 
    1525  
    1526                 /* Look around */ 
    1527                 case 'l': 
    1528                 { 
    1529                         do_cmd_look(); 
    1530                         break; 
    1531                 } 
    1532  
    1533                 /* Target monster or location */ 
    1534                 case '*': 
    1535                 { 
    1536                         do_cmd_target(); 
    1537                         break; 
    1538                 } 
    1539  
    1540  
    1541  
    1542                 /*** Help and Such ***/ 
    1543  
    1544                 /* Help */ 
    1545                 case '?': 
    1546                 { 
    1547                         do_cmd_help(); 
    1548                         break; 
    1549                 } 
    1550  
    1551                 /* Identify symbol */ 
    1552                 case '/': 
    1553                 { 
    1554                         do_cmd_query_symbol(); 
    1555                         break; 
    1556                 } 
    1557  
    1558                 /* Character description */ 
    1559                 case 'C': 
    1560                 { 
    1561                         do_cmd_change_name(); 
    1562                         break; 
    1563                 } 
    1564  
    1565  
    1566                 /*** System Commands ***/ 
    1567  
    1568                 /* Hack -- User interface */ 
    1569                 case '!': 
    1570                 { 
    1571                         (void)Term_user(0); 
    1572                         break; 
    1573                 } 
    1574  
    1575                 /* Single line from a pref file */ 
    1576                 case '"': 
    1577                 { 
    1578                         do_cmd_pref(); 
    1579                         break; 
    1580                 } 
    1581  
    1582                 /* Interact with options */ 
    1583                 case '=': 
    1584                 { 
    1585                         do_cmd_options(); 
    1586                         do_cmd_redraw(); 
    1587                         break; 
    1588                 } 
    1589  
    1590  
    1591                 /*** Misc Commands ***/ 
    1592  
    1593                 /* Take notes */ 
    1594                 case ':': 
    1595                 { 
    1596                         do_cmd_note(); 
    1597                         break; 
    1598                 } 
    1599  
    1600                 /* Version info */ 
    1601                 case 'V': 
    1602                 { 
    1603                         do_cmd_version(); 
    1604                         break; 
    1605                 } 
    1606  
    1607                 /* Repeat level feeling */ 
    1608                 case KTRL('F'): 
    1609                 { 
    1610                         do_cmd_feeling(); 
    1611                         break; 
    1612                 } 
    1613  
    1614                 /* Show previous message */ 
    1615                 case KTRL('O'): 
    1616                 { 
    1617                         do_cmd_message_one(); 
    1618                         break; 
    1619                 } 
    1620  
    1621                 /* Show previous messages */ 
    1622                 case KTRL('P'): 
    1623                 { 
    1624                         do_cmd_messages(); 
    1625                         break; 
    1626                 } 
    1627  
    1628                 /* Redraw the screen */ 
    1629                 case KTRL('R'): 
    1630                 { 
    1631                         do_cmd_redraw(); 
    1632                         break; 
    1633                 } 
    1634  
    1635                 /* Hack -- Save and don't quit */ 
    1636                 case KTRL('S'): 
    1637                 { 
    1638                         do_cmd_save_game(); 
    1639                         break; 
    1640                 } 
    1641  
    1642                 /* Save and quit */ 
    1643                 case KTRL('X'): 
    1644                 { 
    1645                         /* Stop playing */ 
    1646                         p_ptr->playing = FALSE; 
    1647  
    1648                         /* Leaving */ 
    1649                         p_ptr->leaving = TRUE; 
    1650  
    1651                         break; 
    1652                 } 
    1653  
    1654                 /* Quit (commit suicide) */ 
    1655                 case 'Q': 
    1656                 { 
    1657                         do_cmd_suicide(); 
    1658                         break;