Changeset 125
- Timestamp:
- 05/08/07 21:04:38 (1 year ago)
- Files:
-
- trunk/src/cmd4.c (modified) (75 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/cmd4.c
r120 r125 29 29 #define MISSING -17 30 30 31 #define LOAD_PREF 10032 31 #define APP_MACRO 101 33 32 #define ASK_MACRO 103 … … 39 38 #define NEW_KEYMAP 109 40 39 #define ENTER_ACT 110 40 #define LOAD_PREF 111 41 #define DUMP_MON 112 42 #define DUMP_OBJ 113 43 #define DUMP_FEAT 114 44 #define DUMP_FLAV 115 45 #define MOD_MON 116 46 #define MOD_OBJ 117 47 #define MOD_FEAT 118 48 #define MOD_FLAV 119 49 #define DUMP_COL 120 50 #define MOD_COL 121 51 #define RESET_VIS 122 52 53 #define OPTION_MENU 140 54 #define VISUAL_MENU 141 55 #define COLOR_MENU 142 56 #define KNOWLEDGE_MENU 143 57 #define MACRO_MENU 144 41 58 42 59 … … 45 62 46 63 47 typedef struct { 64 typedef struct 65 { 48 66 int maxnum; /* Maximum possible item count for this class */ 49 67 bool easy_know; /* Items don't need to be IDed to recognize membership */ … … 61 79 } group_funcs; 62 80 63 typedef struct { 81 typedef struct 82 { 64 83 65 84 /* Print a tabular-formatted description for an oid */ … … 89 108 90 109 /* Helper class for generating joins */ 91 typedef struct join { 110 typedef struct join 111 { 92 112 int oid; 93 113 int gid; … … 111 131 * Description of each monster group. 112 132 */ 113 static struct { 133 static struct 134 { 114 135 cptr chars; 115 136 cptr name; … … 235 256 { 236 257 Term_putch(col, row, a, c); 237 if (!use_bigtile) return;258 if (!use_bigtile) return; 238 259 if (a &0x80) Term_putch(col+1, row, 255, -1); 239 260 else Term_putch(col+1, row, 1, ' '); … … 242 263 static int actual_width(int width) { 243 264 if (use_trptile) width = width * 3; 244 else if (use_dbltile) width *= 2;245 if (use_bigtile) width *= 2;265 else if (use_dbltile) width *= 2; 266 if (use_bigtile) width *= 2; 246 267 return width; 247 268 } 248 269 249 270 static int actual_height(int height) { 250 if (use_bigtile) height *= 2;271 if (use_bigtile) height *= 2; 251 272 if (use_trptile) height = height * 3 / 2; 252 else if (use_dbltile) height *= 2;273 else if (use_dbltile) height *= 2; 253 274 return height; 254 275 } … … 257 278 { 258 279 int div = 1; 259 if (use_trptile) div = 3;260 else if (use_dbltile) div *= 2;261 if (use_bigtile) div *= 2;280 if (use_trptile) div = 3; 281 else if (use_dbltile) div *= 2; 282 if (use_bigtile) div *= 2; 262 283 return width / div; 263 284 } … … 266 287 { 267 288 int div = 1; 268 if(use_trptile) { 289 if (use_trptile) 290 { 269 291 height *= 2; 270 292 div = 3; 271 293 } 272 else if (use_dbltile) div = 2;273 if (use_bigtile) div *= 2;294 else if (use_dbltile) div = 2; 295 if (use_bigtile) div *= 2; 274 296 return height / div; 275 297 } … … 341 363 342 364 /* Show inscription, if applicable, aware and existing */ 343 if(o_funcs->note && o_funcs->note(oid) && *o_funcs->note(oid)) { 365 if (o_funcs->note && o_funcs->note(oid) && *o_funcs->note(oid)) 366 { 344 367 c_put_str(TERM_YELLOW,quark_str(*o_funcs->note(oid)), row, 65); 345 368 } … … 350 373 351 374 /* Do visual mode */ 352 if(o_funcs->is_visual && o_funcs->xattr) { 375 if (o_funcs->is_visual && o_funcs->xattr) 376 { 353 377 char c = *o_funcs->xchar(oid); 354 378 byte a = *o_funcs->xattr(oid); … … 385 409 int oid = -1; /* object identifiers */ 386 410 387 region title_area = { 0, 0, 0, 4};388 region group_region = { 0, 6, MISSING, -2};389 region object_region = { MISSING, 6, 0, -2};411 region title_area = { 0, 0, 0, 4 }; 412 region group_region = { 0, 6, MISSING, -2 }; 413 region object_region = { MISSING, 6, 0, -2 }; 390 414 391 415 /* display state variables */ … … 427 451 /* Do the group by. ang_sort only works on (void **) */ 428 452 /* Maybe should make this a precondition? */ 429 if (g_funcs.gcomp)453 if (g_funcs.gcomp) 430 454 qsort(obj_list, o_count, sizeof(*obj_list), g_funcs.gcomp); 431 455 … … 433 457 C_MAKE(g_offset, max_group+1, int); 434 458 435 for(i = 0; i < o_count; i++) { 436 if(prev_g != g_funcs.group(obj_list[i])) { 459 for (i = 0; i < o_count; i++) 460 { 461 if (prev_g != g_funcs.group(obj_list[i])) 462 { 437 463 prev_g = g_funcs.group(obj_list[i]); 438 464 g_offset[grp_cnt] = i; … … 443 469 g_list[grp_cnt] = -1; 444 470 445 446 447 471 /* The compact set of group names, in display order */ 448 472 C_MAKE(g_names, grp_cnt, const char **); 449 for (i = 0; i < grp_cnt; i++) { 473 for (i = 0; i < grp_cnt; i++) 474 { 450 475 int len; 451 476 g_names[i] = g_funcs.name(g_list[i]); 452 477 len = strlen(g_names[i]); 453 if(len > g_name_len) g_name_len = len; 454 } 455 if(g_name_len >= 20) g_name_len = 20; 478 if (len > g_name_len) g_name_len = len; 479 } 480 /* Reasonable max group name len */ 481 if (g_name_len >= 20) g_name_len = 20; 456 482 457 483 object_region.col = g_name_len+3; … … 462 488 463 489 /* Leave room for the group summary information */ 464 if (g_funcs.summary) object_region.page_rows = -3;490 if (g_funcs.summary) object_region.page_rows = -3; 465 491 466 492 WIPE(&group_menu, menu_type); … … 483 509 /* Panels are -- text panels, two menus, and visual browser */ 484 510 /* with "pop-up menu" for lore */ 485 while((!flag) && (grp_cnt)) { 511 while ((!flag) && (grp_cnt)) 512 { 486 513 event_type ke, ke0; 487 if(redraw) { 514 if (redraw) 515 { 488 516 region_erase(&title_area); 489 517 prt(format("Knowledge - %s", title), 2, 0); … … 491 519 prt("Name", 4, g_name_len + 3); 492 520 Term_gotoxy(65, 4); 493 if (o_funcs.note)521 if (o_funcs.note) 494 522 Term_addstr(-1, TERM_WHITE, "Inscribed "); 495 if (otherfields)523 if (otherfields) 496 524 Term_addstr(-1, TERM_WHITE, otherfields); 497 525 for (i = 0; i < 78; i++) … … 503 531 } 504 532 505 if(g_cur != grp_old) { 533 if (g_cur != grp_old) 534 { 506 535 grp_old = g_cur; 507 536 o_cur = 0; … … 512 541 } 513 542 /* HACK ... */ 514 if(!visual_list) { 543 if (!visual_list) 544 { 515 545 /* ... The object menu may be browsing the entire group... */ 516 546 o_funcs.is_visual = FALSE; … … 518 548 object_menu.cursor = o_cur; 519 549 } 520 else { 550 else 551 { 521 552 /* ... or just a single element in the group. */ 522 553 o_funcs.is_visual = TRUE; … … 538 569 const char *pvs = (!o_funcs.xattr) ? "" : ", 'v' for visuals"; 539 570 540 if (visual_list)571 if (visual_list) 541 572 prt(format("<dir>, 'r' to recall, ENTER to accept%s, ESC", pedit), hgt-1, 0); 542 573 else … … 544 575 pvs, pedit, pnote, pnote1), hgt-1, 0); 545 576 } 546 if(do_swap) { 577 if (do_swap) 578 { 547 579 do_swap = FALSE; 548 580 swap(active_menu, inactive_menu); … … 551 583 } 552 584 553 if (g_funcs.summary && !visual_list)585 if (g_funcs.summary && !visual_list) 554 586 g_funcs.summary(g_cur, obj_list, g_o_count, g_offset[g_cur], 555 587 object_menu.boundary.row + object_menu.boundary.page_rows, object_region.col); … … 590 622 } 591 623 592 if(ke.type == EVT_MOUSE) { 624 if (ke.type == EVT_MOUSE) 625 { 593 626 /* Change active panels */ 594 if(region_inside(&inactive_menu->boundary, &ke)) { 627 if (region_inside(&inactive_menu->boundary, &ke)) 628 { 595 629 swap(active_menu, inactive_menu); 596 630 swap(active_cursor, inactive_cursor); … … 599 633 } 600 634 ke0 = run_event_loop(&active_menu->target, 0, &ke); 601 if (ke0.type != EVT_AGAIN) ke = ke0;635 if (ke0.type != EVT_AGAIN) ke = ke0; 602 636 switch(ke.type) { 603 637 case EVT_KBRD: … … 607 641 continue; 608 642 case EVT_SELECT: 609 if(panel == 1 && oid >= 0 && o_cur == active_menu->cursor) { 643 if (panel == 1 && oid >= 0 && o_cur == active_menu->cursor) 644 { 610 645 o_funcs.lore(oid); 611 646 redraw = TRUE; … … 615 650 continue; 616 651 case EVT_BACK: 617 if (panel == 1)652 if (panel == 1) 618 653 do_swap = TRUE; 619 654 default: … … 633 668 { 634 669 /* Recall on screen */ 635 if (oid >= 0)670 if (oid >= 0) 636 671 o_funcs.lore(oid); 637 672 … … 694 729 /* Auto-inscribe */ 695 730 if (g_funcs.aware(i_ptr) || cheat_peek) 696 i_ptr->note = note_idx;731 i_ptr->note = note_idx; 697 732 } 698 733 … … 704 739 int d = target_dir(ke.key); 705 740 /* Handle key-driven motion between panels */ 706 if(ddx[d] && ((ddx[d] < 0) == (panel == 1))) { 741 if (ddx[d] && ((ddx[d] < 0) == (panel == 1))) 742 { 707 743 /* Silly hack -- diagonal arithmetic */ 708 744 *inactive_cursor += ddy[d]; 709 if (*inactive_cursor < 0) *inactive_cursor = 0;710 else if (g_cur >= grp_cnt) g_cur = grp_cnt -1;711 else if (o_cur >= g_o_count) o_cur = g_o_count-1;745 if (*inactive_cursor < 0) *inactive_cursor = 0; 746 else if (g_cur >= grp_cnt) g_cur = grp_cnt -1; 747 else if (o_cur >= g_o_count) o_cur = g_o_count-1; 712 748 do_swap = TRUE; 713 749 } 714 else if(o_funcs.note && o_funcs.note(oid)) { 750 else if (o_funcs.note && o_funcs.note(oid)) 751 { 715 752 note_idx = auto_note_modify(*o_funcs.note(oid), ke.key); 716 753 *o_funcs.note(oid) = note_idx; … … 1021 1058 /* group by */ 1022 1059 int c = gid - default_join[*(int*)b].gid; 1023 if (c) return c;1060 if (c) return c; 1024 1061 /* order results */ 1025 1062 c = r_a->d_char - r_b->d_char; 1026 if(c && gid != 0) { 1063 if (c && gid != 0) 1064 { 1027 1065 /* UNIQUE group is ordered by level & name only */ 1028 1066 /* Others by order they appear in the group symbols */ … … 1031 1069 } 1032 1070 c = r_a->level - r_b->level; 1033 if (c) return c;1071 if (c) return c; 1034 1072 return strcmp(r_name + r_a->name, r_name + r_b->name); 1035 1073 } 1036 1074 1037 static char *m_xchar(int oid) 1038 { return &r_info[default_join[oid].oid].x_char; } 1039 static byte *m_xattr(int oid) 1040 { return &r_info[default_join[oid].oid].x_attr; } 1075 static char *m_xchar(int oid) { return &r_info[default_join[oid].oid].x_char; } 1076 static byte *m_xattr(int oid) { return &r_info[default_join[oid].oid].x_attr; } 1041 1077 static const char *race_name(int gid) { return monster_group[gid].name; } 1042 1078 static void mon_lore(int oid) { screen_roff(default_join[oid].oid); inkey_ex(); } … … 1047 1083 int kills = 0; 1048 1084 1049 for(i = 0; i < n; i++) { 1085 for (i = 0; i < n; i++) 1086 { 1050 1087 int oid = default_join[object_list[i+top]].oid; 1051 1088 kills += l_list[oid].pkills; 1052 1089 } 1053 if(gid == 0) { 1090 if (gid == 0) 1091 { 1054 1092 c_prt(TERM_L_BLUE, format("Known Uniques: %d, Slain Uniques: %d.", n, kills), 1055 1093 row, col); 1056 1094 } 1057 else { 1095 else 1096 { 1058 1097 int tkills = 0; 1059 for (i = 0; i < z_info->r_max; i++)1098 for (i = 0; i < z_info->r_max; i++) 1060 1099 tkills += l_list[i].pkills; 1061 1100 c_prt(TERM_L_BLUE, format("Creatures Slain: %d/%d (in group/in total)", kills, tkills), row, col); … … 1079 1118 size_t j; 1080 1119 1081 for(i = 0; i < z_info->r_max; i++) { 1120 for (i = 0; i < z_info->r_max; i++) 1121 { 1082 1122 monster_race *r_ptr = &r_info[i]; 1083 if(!cheat_know && !l_list[i].sights) continue; 1084 if(!r_ptr->name) continue; 1085 1086 if(r_ptr->flags1 & RF1_UNIQUE) m_count++; 1087 for(j = 1; j < N_ELEMENTS(monster_group)-1; j++) { 1123 if (!cheat_know && !l_list[i].sights) continue; 1124 if (!r_ptr->name) continue; 1125 1126 if (r_ptr->flags1 & RF1_UNIQUE) m_count++; 1127 for (j = 1; j < N_ELEMENTS(monster_group)-1; j++) 1128 { 1088 1129 const char *pat = monster_group[j].chars; 1089 if (strchr(pat, r_ptr->d_char)) m_count++;1130 if (strchr(pat, r_ptr->d_char)) m_count++; 1090 1131 } 1091 1132 } … … 1095 1136 1096 1137 m_count = 0; 1097 for(i = 0; i < z_info->r_max; i++) { 1138 for (i = 0; i < z_info->r_max; i++) 1139 { 1098 1140 monster_race *r_ptr = &r_info[i]; 1099 if (!cheat_know && !l_list[i].sights) continue;1100 if (!r_ptr->name) continue;1141 if (!cheat_know && !l_list[i].sights) continue; 1142 if (!r_ptr->name) continue; 1101 1143 1102 for(j = 0; j < N_ELEMENTS(monster_group)-1; j++) { 1144 for (j = 0; j < N_ELEMENTS(monster_group)-1; j++) 1145 { 1103 1146 const char *pat = monster_group[j].chars; 1104 if (j == 0 && !(r_ptr->flags1 & RF1_UNIQUE))1147 if (j == 0 && !(r_ptr->flags1 & RF1_UNIQUE)) 1105 1148 continue; 1106 else if (j > 0 && !strchr(pat, r_ptr->d_char))1149 else if (j > 0 && !strchr(pat, r_ptr->d_char)) 1107 1150 continue; 1108 1151 … … 1168 1211 make_fake_artifact(o_ptr, a_idx); 1169 1212 o_ptr->ident |= IDENT_STORE | IDENT_KNOWN; 1170 if (cheat_xtra) o_ptr->ident |= IDENT_MENTAL;1213 if (cheat_xtra) o_ptr->ident |= IDENT_MENTAL; 1171 1214 1172 1215 /* Hack -- Handle stuff */ … … 1190 1233 int tb = obj_group_order[a_b->tval]; 1191 1234 int c = ta - tb; 1192 if (c) return c;1235 if (c) return c; 1193 1236 1194 1237 /* order by */ 1195 1238 c = a_a->sval - a_b->sval; 1196 if (c) return c;1239 if (c) return c; 1197 1240 return strcmp(a_name+a_a->name, a_name+a_b->name); 1198 1241 } … … 1219 1262 1220 1263 /* Collect valid artifacts */ 1221 for(i = 0; i < z_info->a_max; i++) { 1222 if((cheat_xtra || a_info[i].cur_num) && a_info[i].name) 1264 for (i = 0; i < z_info->a_max; i++) 1265 { 1266 if ((cheat_xtra || a_info[i].cur_num) && a_info[i].name) 1223 1267 artifacts[a_count++] = i; 1224 1268 } 1225 for(i = 0; !cheat_xtra && i < z_info->o_max; i++) { 1269 for (i = 0; !cheat_xtra && i < z_info->o_max; i++) 1270 { 1226 1271 int a = o_list[i].name1; 1227 if(a && !object_known_p(&o_list[i])) { 1228 for(j = 0; j < a_count && a != artifacts[j]; j++); 1272 if (a && !object_known_p(&o_list[i])) 1273 { 1274 for (j = 0; j < a_count && a != artifacts[j]; j++); 1229 1275 a_count -= 1; 1230 for (; j < a_count; j++)1276 for (; j < a_count; j++) 1231 1277 artifacts[j] = artifacts[j+1]; 1232 1278 } … … 1283 1329 /* Begin recall */ 1284 1330 Term_gotoxy(0, 1); 1285 if(e_ptr->text) { 1331 if (e_ptr->text) 1332 { 1286 1333 int x, y; 1287 1334 text_out(e_text + e_ptr->text); … … 1295 1342 object_info_out(&dummy); 1296 1343 1297 if(e_ptr->xtra) { 1344 if (e_ptr->xtra) 1345 { 1298 1346 text_out(format("It provides one random %s.", xtra[e_ptr->xtra - 1])); 1299 1347 } 1300 1348 1301 for(i = 0, f3 = TR3_PERMA_CURSE; i < 3 ; f3 >>= 1, i++) { 1302 if(e_ptr->flags3 & f3) { 1349 for (i = 0, f3 = TR3_PERMA_CURSE; i < 3 ; f3 >>= 1, i++) 1350 { 1351 if (e_ptr->flags3 & f3) 1352 { 1303 1353 text_out_c(TERM_RED, format("It is %s.", cursed[i])); 1304 1354 break; … … 1320 1370 /*group by */ 1321 1371 int c = default_join[*(int*)a].gid - default_join[*(int*)b].gid; 1322 if (c) return c;1372 if (c) return c; 1323 1373 /* order by */ 1324 1374 return strcmp(e_name + ea->name, e_name + eb->name); … … 1342 1392 C_MAKE(egoitems, z_info->e_max*EGO_TVALS_MAX, int); 1343 1393 C_MAKE(default_join, z_info->e_max*EGO_TVALS_MAX, join_t); 1344 for(i = 0; i < z_info->e_max; i++) { 1345 if(e_info[i].everseen || cheat_xtra) { 1346 for(j = 0; j < EGO_TVALS_MAX && e_info[i].tval[j]; j++) 1394 for (i = 0; i < z_info->e_max; i++) 1395 { 1396 if (e_info[i].everseen || cheat_xtra) 1397 { 1398 for (j = 0; j < EGO_TVALS_MAX && e_info[i].tval[j]; j++) 1347 1399 { 1348 1400 int gid = obj_group_order[e_info[i].tval[j]]; 1349 1401 /* Ignore duplicate gids */ 1350 if (j > 0 && gid == default_join[e_count-1].gid)1402 if (j > 0 && gid == default_join[e_count-1].gid) 1351 1403 continue; 1352 1404 egoitems[e_count] = e_count; … … 1450 1502 int tb = obj_group_order[k_b->tval]; 1451 1503 int c = ta - tb; 1452 if (c) return c;1504 if (c) return c; 1453 1505 /* order by */ 1454 1506 c = k_a->aware - k_b->aware; 1455 if(c) return -c; /* aware has low sort weight */ 1456 if(!k_a->aware) { 1507 if (c) return -c; /* aware has low sort weight */ 1508 if (!k_a->aware) 1509 { 1457 1510 return strcmp(flavor_text + flavor_info[k_a->flavor].text, 1458 1511 flavor_text +flavor_info[k_b->flavor].text); 1459 1512 } 1460 1513 c = k_a->cost - k_b->cost; 1461 if (c) return c;1514 if (c) return c; 1462 1515 return strcmp(k_name + k_a->name, k_name + k_b->name); 1463 1516 } … … 1465 1518 static char *o_xchar(int oid) { 1466 1519 object_kind *k_ptr = &k_info[oid]; 1467 if (!k_ptr->flavor || k_ptr->aware) return &k_ptr->x_char;1520 if (!k_ptr->flavor || k_ptr->aware) return &k_ptr->x_char; 1468 1521 else return &flavor_info[k_ptr->flavor].x_char; 1469 1522 } 1470 1523 static byte *o_xattr(int oid) { 1471 1524 object_kind *k_ptr = &k_info[oid]; 1472 if (!k_ptr->flavor || k_ptr->aware) return &k_ptr->x_attr;1525 if (!k_ptr->flavor || k_ptr->aware) return &k_ptr->x_attr; 1473 1526 else return &flavor_info[k_ptr->flavor].x_attr; 1474 1527 } … … 1477 1530 object_kind *k_ptr = &k_info[oid]; 1478 1531 int ind = get_autoinscription_index(oid); 1479 if (!k_ptr->flavor || k_ptr->aware) return (u16b*) &inscriptions[ind].inscription_idx;1532 if (!k_ptr->flavor || k_ptr->aware) return (u16b*) &inscriptions[ind].inscription_idx; 1480 1533 else return 0; 1481 1534 } … … 1495 1548 C_MAKE(objects, z_info->k_max, int); 1496 1549 1497 for(i = 0; i < z_info->k_max; i++) { 1498 if(k_info[i].everseen || k_info[i].flavor || cheat_xtra) { 1550 for (i = 0; i < z_info->k_max; i++) 1551 { 1552 if (k_info[i].everseen || k_info[i].flavor || cheat_xtra) 1553 { 1499 1554 int c = obj_group_order[k_info[i].tval]; 1500 if (c >= 0) objects[o_count++] = i;1555 if (c >= 0) objects[o_count++] = i; 1501 1556 } 1502 1557 } … … 1541 1596 /* group by */ 1542 1597 int c = feat_order(*(int*)a) - feat_order(*(int*)b); 1543 if (c) return c;1598 if (c) return c; 1544 1599 /* order by feature name */ 1545 1600 return strcmp(f_name + fa->name, f_name + fb->name); … … 1566 1621 C_MAKE(features, z_info->f_max, int); 1567 1622 1568 for(i = 0; i < z_info->f_max; i++) { 1569 if(f_info[i].name == 0) continue; 1623 for (i = 0; i < z_info->f_max; i++) 1624 { 1625 if (f_info[i].name == 0) continue; 1570 1626 features[f_count++] = i; /* Currently no filter for features */ 1571 1627 } … … 2134 2190 menu_layout(menu, &SCREEN_REGION); 2135 2191 2136 for (;;)2192 for (;;) 2137 2193 { 2138 2194 event_type cx; 2139 2195 cx = menu_select(menu, &cursor_pos, EVT_MOVE); 2140 2196 if (cx.type == EVT_BACK || ESCAPE == cx.key) break; 2141 if (cx.type == EVT_MOVE) cursor_pos = cx.index;2142 if (cx.type == EVT_SELECT && strchr("YN", toupper(cx.key)))2197 if (cx.type == EVT_MOVE) cursor_pos = cx.index; 2198 if (cx.type == EVT_SELECT && strchr("YN", toupper(cx.key))) 2143 2199 cursor_pos++; 2144 2200 cursor_pos = (cursor_pos+n)%n; … … 2521 2577 2522 2578 /* Failure */ 2523 if (!fff) { 2579 if (!fff) 2580 { 2524 2581 msg_print("Failed"); 2525 2582 return; … … 2915 2972 c = menu_select(¯o_menu, &cursor, EVT_CMD); 2916 2973 2917 if (ESCAPE == c.key)2974 if (ESCAPE == c.key) 2918 2975 break; 2919 2976 evt = macro_actions[cursor].id; … … 3354 3411 event_action visual_menu_items [] = 3355 3412 { 3356 { 'lupf', "Load a user pref file", 0, 0},3357 { 'vdmx', "Dump monster attr/chars", 0, 0},3358 { 'vdox', "Dump object attr/chars", 0, 0},3359 { 'vdfx', "Dump feature attr/chars", 0, 0},3360 { 'vdxx', "Dump flavor attr/chars", 0, 0},3361 { 'vemx', "Change monster attr/chars", 0, 0},3362 { 'veox', "Change object attr/chars", 0, 0},3363 { 'vefx', "Change feature attr/chars", 0, 0},3364 { 'vexx', "Change flavor attr/chars", 0, 0},3365 { 'vrst', "Reset visuals", 0, 0},3413 {LOAD_PREF, "Load a user pref file", 0, 0}, 3414 {DUMP_MON, "Dump monster attr/chars", 0, 0}, 3415 {DUMP_OBJ, "Dump object attr/chars", 0, 0}, 3416 {DUMP_FEAT, "Dump feature attr/chars", 0, 0}, 3417 {DUMP_FLAV, "Dump flavor attr/chars", 0, 0}, 3418 {MOD_MON, "Change monster attr/chars", 0, 0}, 3419 {MOD_OBJ, "Change object attr/chars", 0, 0}, 3420 {MOD_FEAT, "Change feature attr/chars", 0, 0}, 3421 {MOD_FLAV, "Change flavor attr/chars", 0, 0}, 3422 {RESET_VIS, "Reset visuals", 0, 0}, 3366 3423 }; 3367 3424 … … 3388 3445 Term_clear(); 3389 3446 key = menu_select(&visual_menu, &cursor, EVT_CMD); 3390 if (key.key == ESCAPE)3447 if (key.key == ESCAPE) 3391 3448 break; 3392 3449 … … 3395 3452 evt = visual_menu_items[cursor].id; 3396 3453 3397 if (evt == 'lupf')3454 if (evt == LOAD_PREF) 3398 3455 { 3399 3456 /* Ask for and load a user pref file */ … … 3403 3460 #ifdef ALLOW_VISUALS 3404 3461 3405 else if (evt == 'vdmx')3462 else if (evt == DUMP_MON) 3406 3463 { 3407 3464 dump_pref_file(dump_monsters, "Dump Monster attr/chars"); 3408 3465 } 3409 3466 3410 else if (evt == 'vdox')3467 else if (evt == DUMP_OBJ) 3411 3468 { 3412 3469 dump_pref_file(dump_objects, "Dump Object attr/chars"); 3413 3470 } 3414 3471 3415 else if (evt == 'vdfx')3472 else if (evt == DUMP_FEAT) 3416 3473 { 3417 3474 dump_pref_file(dump_features, "Dump Feature attr/chars"); … … 3419 3476 3420 3477 /* Dump flavor attr/chars */ 3421 else if (evt == 'vdxx')3478 else if (evt == DUMP_FLAV) 3422 3479 { 3423 3480 dump_pref_file(dump_flavors, "Dump Flavor attr/chars"); … … 3425 3482 3426 3483 /* Modify monster attr/chars */ 3427 else if (evt == 'vemx')3484 else if (evt == MOD_MON) 3428 3485 { 3429 3486 static int r = 0; … … 3450 3507 3451 3508 /* Modify object attr/chars */ 3452 else if (evt == 'veox')3509 else if (evt == MOD_OBJ) 3453 3510 { 3454 3511 static int k = 0; … … 3470 3527 3471 3528 /* Modify feature attr/chars */ 3472 else if (evt == 'vefx')3529 else if (evt == MOD_FEAT) 3473 3530 { 3474 3531 static int f = 0; … … 3488 3545 } 3489 3546 /* Modify flavor attr/chars */ 3490 else if (evt == 'vexx')3547 else if (evt == MOD_FLAV) 3491 3548 { 3492 3549 static int f = 0; … … 3509 3566 3510 3567 /* Reset visuals */ 3511 else if (evt == 'vrst')3568 else if (evt == RESET_VIS) 3512 3569 { 3513 3570 /* Reset */ … … 3526 3583 static event_action color_events [] = 3527 3584 { 3528 { 'lupf', "Load a user pref file", 0, 0},3585 {LOAD_PREF, "Load a user pref file", 0, 0}, 3529 3586 #ifdef ALLOW_COLORS 3530 { 'vdco', "Dump colors", 0, 0},3531 { 'veco', "Modify colors", 0, 0}3587 {DUMP_COL, "Dump colors", 0, 0}, 3588 {MOD_COL, "Modify colors", 0, 0} 3532 3589 #endif 3533 3590 }; … … 3565 3622 3566 3623 /* Load a user pref file */ 3567 if (evt == 'lupf')3624 if (evt == LOAD_PREF) 3568 3625 { 3569 3626 /* Ask for and load a user pref file */ … … 3582 3639 3583 3640 /* Dump colors */ 3584 else if (evt == 'vdco')3641 else if (evt == DUMP_COL) 3585 3642 { 3586 3643 dump_pref_file(dump_colors, "Dump Colors"); … … 3588 3645 3589 3646 /* Edit colors */ 3590 else if (evt == 'veco')3647 else if (evt == MOD_COL) 3591 3648 { 3592 3649 static byte a = 0; … … 3955 4012 3956 4013 /* Ask for a file */ 3957 if (mode == 0) my_strcpy(tmp_val, "dump.html", sizeof(tmp_val));4014 if (mode == 0) my_strcpy(tmp_val, "dump.html", sizeof(tmp_val)); 3958 4015 else my_strcpy(tmp_val, "dump.txt", sizeof(tmp_val)); 3959 4016 if (!get_string("File: ", tmp_val, sizeof(tmp_val))) return; … … 3997 4054 { 3998 4055 msg_print("Dump type [(t)ext; (h)tml; (f)orum embedded html]:"); 3999 for(;;) { 4056 for (;;) 4057 { 4000 4058 int c = inkey(); 4001 4059 switch(c) { … … 4116 4174 menu = &option_menu; 4117 4175 WIPE(menu, menu_type); 4118 menu_set_id(menu, 'opti');4176 menu_set_id(menu, OPTION_MENU); 4119 4177 menu->title = "Options Menu"; 4120 4178 menu->count = N_ELEMENTS(option_actions); … … 4125 4183 menu = ¯o_menu; 4126 4184 WIPE(menu, menu_type); 4127 menu_set_id(menu, 'macr');4185 menu_set_id(menu, MACRO_MENU); 4128 4186 menu->count = N_ELEMENTS(macro_actions); 4129 4187 menu->menu_data = macro_actions; … … 4134 4192 menu = &knowledge_menu; 4135 4193 WIPE(menu, menu_type); 4136 menu_set_id(menu, 'know');4194 menu_set_id(menu, KNOWLEDGE_MENU); 4137 4195 menu->title = "Display current knowledge"; 4138 4196 menu->count = N_ELEMENTS(knowledge_actions), … … 4143 4201 menu = &visual_menu; 4144 4202 WIPE(menu, menu_type); 4145 menu_set_id(menu, 'visu');4203 menu_set_id(menu, VISUAL_MENU); 4146 4204 menu->title = "Interact with visuals"; 4147 4205 menu->selections = default_choice; … … 4153 4211 menu = &color_menu; 4154 4212 WIPE(menu, menu_type); 4155 menu_set_id(menu, 'colr');4213 menu_set_id(menu, COLOR_MENU); 4156 4214 menu->title = "Interact with colors"; 4157 4215 menu->selections = default_choice; … … 4175 4233 for (i = 0; 0 != object_text_order[i].tval; i++) 4176 4234 { 4177 if (object_text_order[i].name) gid = i;4235 if (object_text_order[i].name) gid = i; 4178 4236 obj_group_order[object_text_order[i].tval] = gid; 4179 4237 }
