Changeset 30
- Timestamp:
- 04/02/07 23:25:43 (1 year ago)
- Files:
-
- trunk/src/birth.c (modified) (3 diffs)
- trunk/src/cave.c (modified) (1 diff)
- trunk/src/cmd4.c (modified) (17 diffs)
- trunk/src/defines.h (modified) (2 diffs)
- trunk/src/main-crb.c (modified) (7 diffs)
- trunk/src/obj-info.c (modified) (1 diff)
- trunk/src/osx/osx_tables.h (modified) (2 diffs)
- trunk/src/tables.c (modified) (6 diffs)
- trunk/src/ui.c (modified) (3 diffs)
- trunk/src/ui.h (modified) (1 diff)
- trunk/src/xtra1.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/birth.c
r28 r30 634 634 * Display additional information about each race during the selection. 635 635 */ 636 static void race_aux_hook(int race, const region *reg)636 static void race_aux_hook(int race, void *db, const region *reg) 637 637 { 638 638 int i; … … 661 661 * Display additional information about each class during the selection. 662 662 */ 663 static void class_aux_hook(int class_idx, const region *loc)663 static void class_aux_hook(int class_idx, void *db, const region *loc) 664 664 { 665 665 int i; … … 783 783 "Your 'class' determines various intrinsic abilities and bonuses" }; 784 784 785 typedef void (*browse_f) (int oid, const region *loc);785 typedef void (*browse_f) (int oid, void *, const region *loc); 786 786 browse_f browse [] = {NULL, race_aux_hook, class_aux_hook }; 787 787 menu_type menu; trunk/src/cave.c
r24 r30 991 991 /* Get the "player" attr */ 992 992 a = r_ptr->x_attr; 993 if ((hp_changes_color) && (arg_graphics == GRAPHICS_NONE)) 994 { 995 switch(p_ptr->chp * 10 / p_ptr->mhp) 996 { 997 case 10: 998 case 9: a = TERM_WHITE ; break; 999 case 8: 1000 case 7: a = TERM_YELLOW ; break; 1001 case 6: 1002 case 5: a = TERM_ORANGE ; break; 1003 case 4: 1004 case 3: a = TERM_L_RED ; break; 1005 case 2: 1006 case 1: 1007 case 0: a = TERM_RED ; break; 1008 default: a = TERM_WHITE ; break; 1009 } 1010 } 993 1011 994 1012 /* Get the "player" char */ trunk/src/cmd4.c
r29 r30 39 39 bool (*aware)(object_type *obj); /* Object is known sufficiently for group */ 40 40 41 /* summary function for the "object" information. */ 42 void (*summary)(int gid, const int *object_list, int n, int top, int row, int col); 41 43 } group_funcs; 42 44 43 45 typedef struct { 44 46 47 /* Print a tabular-formatted description for an oid */ 48 /* This includes things like kill-count, the current graphic, */ 49 /* any tile illumination info. Item id for Wizard mode and */ 50 /* autoinscription are handled by the caller */ 45 51 void (*display_member)(int col, int row, bool cursor, int oid); 46 52 47 53 void (*lore)(int oid); /* Dump known lore to screen*/ 54 48 55 49 56 /* Required only for objects with modifiable display attributes */ … … 115 122 { "k", "Kobolds" }, 116 123 { "L", "Lichs" }, 124 { "tp", "Men" }, 117 125 { "$?!_", "Mimics" }, 118 126 { "m", "Molds" }, … … 120 128 { "n", "Nagas" }, 121 129 { "o", "Orcs" }, 122 { "tp", "Humans" },123 130 { "q", "Quadrupeds" }, 124 131 { "Q", "Quylthulgs" }, … … 305 312 } 306 313 307 /*308 * Display a list with a cursor309 */310 static void display_group_list(int col, int row, int wid, int per_page,311 int start, int max, int cursor, const cptr group_text[])312 {313 int i, pos;314 315 /* Display lines until done */316 for (i = 0, pos = start; i < per_page && pos < max; i++, pos++)317 {318 char buffer[21];319 byte attr = curs_attrs[CURS_KNOWN][cursor == pos];320 321 /* Erase the line */322 Term_erase(col, row + i, wid);323 324 /* Display it (width should not exceed 20) */325 strncpy(buffer, group_text[pos], 20);326 buffer[20] = 0;327 c_put_str(attr, buffer, row + i, col);328 }329 /* Wipe the rest? */330 }331 314 332 315 static void display_group_member(menu_type *menu, int oid, … … 340 323 c_put_str(TERM_YELLOW,quark_str(*o_funcs->note(oid)), row, 65); 341 324 } 325 /* Print the interesting part */ 342 326 o_funcs->display_member(col, row, cursor, oid); 343 327 … … 393 377 394 378 /* Panel state */ 379 /* These are swapped in parallel whenever the actively browsing " */ 380 /* changes */ 395 381 int *active_cursor = &g_cur, *inactive_cursor = &o_cur; 396 382 menu_type *active_menu = &group_menu, *inactive_menu = &object_menu; 397 383 int panel = 0; 384 398 385 void *swapspace; 399 386 bool do_swap = FALSE; … … 446 433 447 434 region title_area = {0, 0, 0, 4}; 448 region group_region = {0, 6, g_name_len, - 1};435 region group_region = {0, 6, g_name_len, -2}; 449 436 region object_region = {g_name_len+3, 6, 0, -2}; 437 438 /* Leave room for the group summary information */ 439 if(g_funcs.summary) object_region.page_rows = -3; 450 440 451 441 WIPE(&group_menu, menu_type); 452 442 group_menu.count = grp_cnt; 453 group_menu.cmd_keys = "\n\r6\x8C"; /* Don't treat this as motion*/443 group_menu.cmd_keys = "\n\r6\x8C"; /* Ignore these as menu commands */ 454 444 group_menu.menu_data = g_names; 455 445 … … 506 496 /* ... or just a single element in the group. */ 507 497 o_funcs.is_visual = TRUE; 508 menu_set_filter(&object_menu, obj_list + o_cur , 1);498 menu_set_filter(&object_menu, obj_list + o_cur +g_offset[g_cur], 1); 509 499 object_menu.cursor = 0; 510 500 } … … 536 526 } 537 527 528 if(g_funcs.summary && !visual_list) 529 g_funcs.summary(g_cur, obj_list, g_o_count, g_offset[g_cur], 530 object_menu.boundary.row + object_menu.boundary.page_rows, object_region.col); 538 531 menu_refresh(inactive_menu); 539 532 menu_refresh(active_menu); … … 542 535 if (visual_list) 543 536 { 537 538 display_visual_list(g_name_len + 3, 7, browser_rows-1, 539 wid - (g_name_len + 3), attr_top, char_left); 544 540 place_visual_list_cursor(g_name_len + 3, 7, *o_funcs.xattr(oid), 545 541 *o_funcs.xchar(oid), attr_top, char_left); … … 684 680 int d = target_dir(ke.key); 685 681 /* Handle key-driven motion between panels */ 686 if( (ddx[d] < 0) && panel == 1) {682 if(ddx[d] && ((ddx[d] < 0) == (panel == 1))) { 687 683 /* Silly hack -- diagonal arithmetic */ 688 g_cur += -(ddy[d] < 0) + (ddy[d] > 0); 689 if(g_cur < 0) g_cur = 0; 690 if(g_cur >= grp_cnt) g_cur = grp_cnt -1; 691 do_swap = TRUE; 692 } 693 else if((ddx[d] > 0) == (panel == 0)) { 694 o_cur += -(ddy[d] < 0) + (ddy[d] > 0); 695 if(o_cur < 0) o_cur = 0; 696 if(o_cur >= g_o_count) o_cur = g_o_count-1; 684 *inactive_cursor += ddy[d]; 685 if(*inactive_cursor < 0) *inactive_cursor = 0; 686 else if(g_cur >= grp_cnt) g_cur = grp_cnt -1; 687 else if(o_cur >= g_o_count) o_cur = g_o_count-1; 697 688 do_swap = TRUE; 698 689 } … … 1027 1018 static void mon_lore(int oid) { screen_roff(default_join[oid].oid); inkey_ex(); } 1028 1019 1020 static void mon_summary(int gid, const int *object_list, int n, int top, int row, int col) 1021 { 1022 int i; 1023 int kills = 0; 1024 1025 for(i = 0; i < n; i++) { 1026 int oid = default_join[object_list[i+top]].oid; 1027 kills += l_list[oid].pkills; 1028 } 1029 if(gid == 0) { 1030 c_prt(TERM_L_BLUE, format("Known Uniques: %d, Slain Uniques: %d.", n, kills), 1031 row, col); 1032 } 1033 else { 1034 int tkills = 0; 1035 for(i = 0; i < z_info->r_max; i++) 1036 tkills += l_list[i].pkills; 1037 c_prt(TERM_L_BLUE, format("Creatures Slain: %d/%d (in group/in total)", kills, tkills), row, col); 1038 } 1039 } 1040 1029 1041 /* 1030 1042 * Display known monsters. … … 1032 1044 static void do_cmd_knowledge_monsters(void) 1033 1045 { 1034 group_funcs r_funcs = {N_ELEMENTS(monster_group), FALSE, race_name,1035 m_cmp_race, default_group, 0 };1046 group_funcs r_funcs = {N_ELEMENTS(monster_group), FALSE, race_name, 1047 m_cmp_race, default_group, 0, mon_summary}; 1036 1048 1037 1049 member_funcs m_funcs = {display_monster, mon_lore, m_xchar, m_xattr, 0, 0}; … … 1172 1184 { 1173 1185 /* HACK -- should be TV_MAX */ 1174 group_funcs obj_f = {TV_GOLD, FALSE, kind_name, a_cmp_tval, art2tval, 0 };1175 member_funcs art_f = {display_artifact, desc_art_fake, 0, 0, 0 };1186 group_funcs obj_f = {TV_GOLD, FALSE, kind_name, a_cmp_tval, art2tval, 0, 0}; 1187 member_funcs art_f = {display_artifact, desc_art_fake, 0, 0, 0, 0}; 1176 1188 1177 1189 … … 1294 1306 { 1295 1307 group_funcs obj_f = 1296 {TV_GOLD, FALSE, ego_grp_name, e_cmp_tval, default_group, 0 };1297 1298 member_funcs ego_f = {display_ego_item, desc_ego_fake, 0, 0, 0 /*e_note */ };1308 {TV_GOLD, FALSE, ego_grp_name, e_cmp_tval, default_group, 0, 0}; 1309 1310 member_funcs ego_f = {display_ego_item, desc_ego_fake, 0, 0, 0, 0/*e_note */ }; 1299 1311 1300 1312 int *egoitems; … … 1450 1462 static void do_cmd_knowledge_objects(void) 1451 1463 { 1452 group_funcs kind_f = {TV_GOLD, FALSE, kind_name, o_cmp_tval, obj2gid, 0 };1464 group_funcs kind_f = {TV_GOLD, FALSE, kind_name, o_cmp_tval, obj2gid, 0, 0}; 1453 1465 member_funcs obj_f = {display_object, desc_obj_fake, o_xchar, o_xattr,0 /* o_note*/}; 1454 1466 … … 1521 1533 { 1522 1534 group_funcs fkind_f = {N_ELEMENTS(feature_group_text), FALSE, 1523 fkind_name, f_cmp_fkind, feat_order, 0 };1535 fkind_name, f_cmp_fkind, feat_order, 0, 0}; 1524 1536 1525 1537 member_funcs feat_f = {display_feature, feat_lore, f_xchar, f_xattr, 0}; trunk/src/defines.h
r28 r30 2539 2539 #define OPT_smart_monsters 72 2540 2540 #define OPT_smart_packs 73 2541 /* xxx */ 2541 #define OPT_hp_changes_color 74 2542 2542 /* xxx */ 2543 2543 /* xxx */ … … 2659 2659 #define smart_monsters op_ptr->opt[OPT_smart_monsters] 2660 2660 #define smart_packs op_ptr->opt[OPT_smart_packs] 2661 /* xxx */ 2661 #define hp_changes_color op_ptr->opt[OPT_hp_changes_color] 2662 2662 /* xxx */ 2663 2663 /* xxx */ trunk/src/main-crb.c
r9 r30 854 854 855 855 856 BitMap tScreen; 856 857 /* Get current screen */ 857 hibernate();858 BitMap tScreen;859 858 (void)GetQDGlobalsScreenBits(&tScreen); 860 861 859 /* Verify the bottom */ 862 860 if (td->r.top > tScreen.bounds.bottom - td->size_hgt) … … 864 862 td->r.top = tScreen.bounds.bottom - td->size_hgt; 865 863 } 866 867 864 /* Verify the top */ 868 if (td->r.top < tScreen.bounds.top + GetMBarHeight()) 869 { 870 td->r.top = tScreen.bounds.top + GetMBarHeight(); 871 } 872 865 if (td->r.top < tScreen.bounds.top + 2*GetMBarHeight()) 866 { 867 td->r.top = tScreen.bounds.top + 2*GetMBarHeight(); 868 } 873 869 /* Verify the right */ 874 870 if (td->r.left > tScreen.bounds.right - td->size_wid) … … 876 872 td->r.left = tScreen.bounds.right - td->size_wid; 877 873 } 878 879 874 /* Verify the left */ 880 875 if (td->r.left < tScreen.bounds.left) … … 2823 2818 int x, y; 2824 2819 WindowRef w = 0; 2820 unsigned flags; 2825 2821 2826 2822 term_data *td; 2827 2823 term *old = Term; 2824 int err ; 2828 2825 2829 2826 GetEventParameter(inEvent, kEventParamDirectObject, 2830 2827 typeWindowRef, NULL, sizeof(w), NULL, &w); 2828 err = GetEventParameter(inEvent, kEventParamAttributes, 2829 typeUInt32, NULL, sizeof(flags), NULL, &flags); 2831 2830 2832 2831 td = (term_data*) GetWRefCon(w); … … 2835 2834 if (!td) return noErr; 2836 2835 2836 2837 2837 /* Obtain geometry of resized window */ 2838 2838 2839 2839 Rect tmpR; 2840 2840 GetWindowBounds((WindowRef)td->w, kWindowContentRgn, &tmpR); 2841 td->r = tmpR; 2842 if(td->r.top < 40) td->r.top = 40; 2841 2843 2842 2844 /* Extract the new ClipRect size in pixels */ … … 2847 2849 td->rows = y / td->tile_hgt; 2848 2850 td->cols = x / td->tile_wid; 2851 2849 2852 2850 2853 /* Apply and Verify */ … … 3227 3230 p.x -= (BORDER_WID+td->r.left); 3228 3231 // Y coordinate relative to top of window content region. 3229 // HACK: assumes title width of 21 pixels. 3230 p.y -= (td->r.top + 21); 3232 p.y -= td->r.top; 3231 3233 3232 3234 Term_mousepress(p.x/td->tile_wid, p.y/td->tile_hgt, button); trunk/src/obj-info.c
r1 r30 594 594 595 595 /* Wait for input */ 596 (void) inkey();596 (void)anykey(); 597 597 598 598 /* Load the screen */ trunk/src/osx/osx_tables.h
r9 r30 125 125 #define WNUPD kEventWindowUpdate 126 126 #define WNRSZ kEventWindowResizeCompleted 127 #define WNDRG kEventWindowDragCompleted 127 128 128 129 #define HANDLERDEF(func) \ … … 180 181 181 182 { 'wind', WNRSZ, ResizeCommand, kWINDOW, NULL }, // Change window size 183 { 'wind', WNDRG, ResizeCommand, kWINDOW, NULL }, // Change window size 182 184 { 'appl', kEventAppActivated, 183 185 ResumeCommand, 0, NULL }, trunk/src/tables.c
r16 r30 1471 1471 "smart_monsters", /* OPT_smart_monsters */ 1472 1472 "smart_packs", /* OPT_smart_packs */ 1473 NULL, /* xxx*/1473 "hp_changes_color", /* OPT_hp_changes_color */ 1474 1474 NULL, /* xxx */ 1475 1475 NULL, /* xxx */ … … 1735 1735 "Monsters behave more intelligently", /* OPT_smart_monsters */ 1736 1736 "Monsters act smarter in groups (v.slow)", /* OPT_smart_packs */ 1737 NULL, /* xxx*/1737 "Player color indicates low hit points", /* OPT_hp_changes_color */ 1738 1738 NULL, /* xxx */ 1739 1739 NULL, /* xxx */ … … 1941 1941 TRUE, /* OPT_ring_bell */ 1942 1942 TRUE, /* OPT_show_flavors */ 1943 TRUE, /* OPT_run_ignore_stairs */1944 TRUE, /* OPT_run_ignore_doors */1943 FALSE, /* OPT_run_ignore_stairs */ 1944 FALSE, /* OPT_run_ignore_doors */ 1945 1945 TRUE, /* OPT_run_cut_corners */ 1946 1946 TRUE, /* OPT_run_use_corners */ 1947 TRUE, /* OPT_disturb_move */1947 FALSE, /* OPT_disturb_move */ 1948 1948 TRUE, /* OPT_disturb_near */ 1949 1949 TRUE, /* OPT_disturb_panel */ … … 1964 1964 TRUE, /* OPT_expand_list */ 1965 1965 TRUE, /* OPT_view_perma_grids */ 1966 FALSE, /* OPT_view_torch_grids */1966 TRUE, /* OPT_view_torch_grids */ 1967 1967 TRUE, /* OPT_dungeon_align */ 1968 1968 TRUE, /* OPT_dungeon_stair */ 1969 FALSE, /* OPT_flow_by_sound */1970 FALSE, /* OPT_flow_by_smell */1969 TRUE, /* OPT_flow_by_sound */ 1970 TRUE, /* OPT_flow_by_smell */ 1971 1971 FALSE, /* xxx track_follow */ 1972 1972 FALSE, /* xxx track_target */ … … 1999 1999 FALSE, /* OPT_smart_monsters */ 2000 2000 FALSE, /* OPT_smart_packs */ 2001 FALSE, /* xxx*/2001 FALSE, /* OPT_hp_changes_color */ 2002 2002 FALSE, /* xxx */ 2003 2003 FALSE, /* xxx */ … … 2306 2306 OPT_run_avoid_center, 2307 2307 OPT_show_piles, 2308 OPT_ NONE,2308 OPT_hp_changes_color, 2309 2309 OPT_NONE, 2310 2310 OPT_NONE, trunk/src/ui.c
r29 r30 289 289 { 290 290 int cursor = row - loc->row + top; 291 if(cursor < top) cursor = top-1; 292 else if(cursor > loc->page_rows) cursor = loc->page_rows; 293 if(cursor < 0) cursor = 0; 294 else if(cursor >= n) cursor = n-1; 291 if(cursor >= n) cursor = n-1; 295 292 296 293 return cursor; … … 523 520 menu->skin->display_list(menu, menu->cursor, &menu->top, &menu->active); 524 521 if(menu->browse_hook && oid >= 0) { 525 menu->browse_hook(oid, loc);522 menu->browse_hook(oid, menu->menu_data, loc); 526 523 } 527 524 } … … 615 612 /* cursor movement */ 616 613 dir = target_dir(in->key); 617 if(dir == 2 ) { 618 int ind; 619 out.type = EVT_MOVE; 620 for(ind = *cursor+1; ind < n && (TRUE != is_valid_row(menu, ind)); ind++) 621 ; 622 out.index = ind; 623 if(ind < n) *cursor = ind; 624 } 625 else if(dir == 8) { 626 int ind; 627 out.type = EVT_MOVE; 628 out.key = '\xff'; 629 for(ind = *cursor-1; ind >=0 && (TRUE != is_valid_row(menu, ind)); ind--) 630 ; 631 out.index = ind; 632 if(ind >= 0) *cursor = ind; 633 } 634 else if(dir == 4) { 635 out.type = EVT_BACK; 614 if(ddx[dir] && ddy[dir]) return FALSE; /* Reject diagonals */ 615 else if(ddx[dir]) { 616 out.type = ddx[dir] < 0 ? EVT_BACK : EVT_SELECT; 636 617 out.key = '\xff'; 637 618 out.index = *cursor; 638 619 } 639 else if(dir == 6) { /* Selection event */ 640 out.type = EVT_SELECT; 641 out.key = '\xff'; 642 out.index = *cursor; 620 else if(ddy[dir]) { /* Move up or down to the next valid & visible row */ 621 int ind; 622 int dy = ddy[dir]; 623 out.type = EVT_MOVE; 624 for(ind = *cursor + dy; ind < n && ind >= 0 625 && (TRUE != is_valid_row(menu, ind)); ind += dy) ; 626 out.index = ind; 627 if(ind < n && ind >= 0) *cursor = ind; 643 628 } 644 629 else return FALSE; trunk/src/ui.h
r29 r30 273 273 274 274 /* auxiliary browser help function */ 275 void (*browse_hook)(int oid, const region *loc);275 void (*browse_hook)(int oid, void *db, const region *loc); 276 276 277 277 trunk/src/xtra1.c
r24 r30 3025 3025 prt_cur_hp(ROW_CURHP, COL_CURHP); 3026 3026 prt_max_hp(ROW_MAXHP, COL_MAXHP); 3027 3028 /* 3029 * hack: redraw player, since the player's color 3030 * now indicates approximate health. Note that 3031 * using this command when graphics mode is on 3032 * causes the character to be a black square. 3033 */ 3034 if ((hp_changes_color) && (arg_graphics == GRAPHICS_NONE)) 3035 { 3036 lite_spot(p_ptr->py, p_ptr->px); 3037 } 3038 3027 3039 } 3028 3040
