Only in angband-290/src: Makefile Only in angband-290/src: angband Only in angband-290/src: birth.o diff -r -c angband-290-src/src/cave.c angband-290/src/cave.c *** angband-290-src/src/cave.c Mon Apr 10 01:42:28 2000 --- angband-290/src/cave.c Mon Apr 24 23:51:15 2000 *************** *** 1312,1328 **** /* - * Display highest priority object in the RATIO by RATIO area - */ - #define RATIO 3 - - /* - * Display the entire map - */ - #define MAP_HGT (DUNGEON_HGT / RATIO) - #define MAP_WID (DUNGEON_WID / RATIO) - - /* * Hack -- priority array (see below) * * Note that all "walls" always look like "secret doors" (see "map_info()"). --- 1312,1317 ---- *************** *** 1401,1421 **** /* ! * Display a "small-scale" map of the dungeon in the active Term * ! * Note that this function must "disable" the special lighting ! * effects so that the "priority" function will work. * ! * Note the use of a specialized "priority" function to allow this ! * function to work with any graphic attr/char mappings, and the ! * attempts to optimize this function where possible. */ void display_map(int *cy, int *cx) { int py = p_ptr->py; int px = p_ptr->px; ! int i, j, x, y; byte ta; char tc; --- 1390,1422 ---- /* ! * Maximum size of map. ! */ ! #define MAP_HGT (DUNGEON_HGT / 3) ! #define MAP_WID (DUNGEON_WID / 3) ! ! ! /* ! * Display a "small-scale" map of the dungeon in the active Term. * ! * Note that this function must "disable" the special lighting effects so ! * that the "priority" function will work. * ! * Note the use of a specialized "priority" function to allow this function ! * to work with any graphic attr/char mappings, and the attempts to optimize ! * this function where possible. ! * ! * Returns the screen location at which the player may be displayed, if the ! * caller wishes to do so. */ void display_map(int *cy, int *cx) { int py = p_ptr->py; int px = p_ptr->px; ! int map_hgt, map_wid; ! ! int x, y; byte ta; char tc; *************** *** 1431,1436 **** --- 1432,1455 ---- bool old_view_granite_lite; + /* Desired map height */ + map_hgt = Term->hgt - 2; + map_wid = Term->wid - 2; + + /* Prevent accidents */ + if (map_hgt > MAP_HGT) map_hgt = MAP_HGT; + if (map_wid > MAP_WID) map_wid = MAP_WID; + + + /* Player location */ + (*cy) = (py * map_hgt / DUNGEON_HGT) + 1; + (*cx) = (px * map_wid / DUNGEON_WID) + 1; + + + /* Prevent accidents or silliness */ + if ((map_wid < 1) || (map_hgt < 1)) return; + + /* Save lighting effects */ old_view_special_lite = view_special_lite; old_view_granite_lite = view_granite_lite; *************** *** 1440,1449 **** view_granite_lite = FALSE; ! /* Clear the chars and attributes */ ! for (y = 0; y < MAP_HGT+2; ++y) { ! for (x = 0; x < MAP_WID+2; ++x) { /* Nothing here */ ma[y][x] = TERM_WHITE; --- 1459,1468 ---- view_granite_lite = FALSE; ! /* Clear the small scale map */ ! for (y = 0; y < map_hgt + 2; ++y) { ! for (x = 0; x < map_wid + 2; ++x) { /* Nothing here */ ma[y][x] = TERM_WHITE; *************** *** 1454,1516 **** } } ! /* Fill in the map */ ! for (i = 0; i < DUNGEON_WID; ++i) { ! for (j = 0; j < DUNGEON_HGT; ++j) { ! /* Location */ ! x = i / RATIO + 1; ! y = j / RATIO + 1; ! /* Extract the current attr/char at that map location */ #ifdef USE_TRANSPARENCY ! map_info(j, i, &ta, &tc, &ta, &tc); #else /* USE_TRANSPARENCY */ ! map_info(j, i, &ta, &tc); #endif /* USE_TRANSPARENCY */ ! /* Extract the priority of that attr/char */ tp = priority(ta, tc); /* Save "best" */ ! if (mp[y][x] < tp) { /* Save the char */ ! mc[y][x] = tc; /* Save the attr */ ! ma[y][x] = ta; /* Save priority */ ! mp[y][x] = tp; } } } - /* Corners */ ! x = MAP_WID + 1; ! y = MAP_HGT + 1; /* Draw the corners */ mc[0][0] = mc[0][x] = mc[y][0] = mc[y][x] = '+'; /* Draw the horizontal edges */ ! for (x = 1; x <= MAP_WID; x++) mc[0][x] = mc[y][x] = '-'; /* Draw the vertical edges */ ! for (y = 1; y <= MAP_HGT; y++) mc[y][0] = mc[y][x] = '|'; ! ! /* Display each map line in order */ ! for (y = 0; y < MAP_HGT+2; ++y) { /* Start a new line */ Term_gotoxy(0, y); /* Display the line */ ! for (x = 0; x < MAP_WID+2; ++x) { ta = ma[y][x]; tc = mc[y][x]; --- 1473,1533 ---- } } ! ! /* Analyze the actual map */ ! for (y = 0; y < DUNGEON_HGT; y++) { ! for (x = 0; x < DUNGEON_WID; x++) { ! int row = (y * map_hgt / DUNGEON_HGT) + 1; ! int col = (x * map_wid / DUNGEON_WID) + 1; ! /* Get the attr/char at that map location */ #ifdef USE_TRANSPARENCY ! map_info(y, x, &ta, &tc, &ta, &tc); #else /* USE_TRANSPARENCY */ ! map_info(y, x, &ta, &tc); #endif /* USE_TRANSPARENCY */ ! /* Get the priority of that attr/char */ tp = priority(ta, tc); /* Save "best" */ ! if (mp[row][col] < tp) { /* Save the char */ ! mc[row][col] = tc; /* Save the attr */ ! ma[row][col] = ta; /* Save priority */ ! mp[row][col] = tp; } } } /* Corners */ ! x = map_wid + 1; ! y = map_hgt + 1; /* Draw the corners */ mc[0][0] = mc[0][x] = mc[y][0] = mc[y][x] = '+'; /* Draw the horizontal edges */ ! for (x = 1; x <= map_wid; x++) mc[0][x] = mc[y][x] = '-'; /* Draw the vertical edges */ ! for (y = 1; y <= map_hgt; y++) mc[y][0] = mc[y][x] = '|'; ! /* Display the small scale map */ ! for (y = 0; y < map_hgt + 2; y++) { /* Start a new line */ Term_gotoxy(0, y); /* Display the line */ ! for (x = 0; x < map_wid + 2; x++) { ta = ma[y][x]; tc = mc[y][x]; *************** *** 1519,1529 **** Term_addch(ta, tc); } } - - - /* Player location */ - (*cy) = py / RATIO + 1; - (*cx) = px / RATIO + 1; /* Restore lighting effects */ --- 1536,1541 ---- Only in angband-290/src: cave.o Only in angband-290/src: cmd1.o Only in angband-290/src: cmd2.o diff -r -c angband-290-src/src/cmd3.c angband-290/src/cmd3.c *** angband-290-src/src/cmd3.c Mon Apr 10 01:42:28 2000 --- angband-290/src/cmd3.c Sun Apr 23 21:54:56 2000 *************** *** 947,991 **** */ void do_cmd_locate(void) { ! int dir, y1, x1, y2, x2; ! char tmp_val[80]; ! char out_val[160]; - /* Start at current panel */ - y2 = y1 = p_ptr->wy; - x2 = x1 = p_ptr->wx; - /* Show panels until done */ - while (1) - { /* Describe the location */ ! if ((y2 == y1) && (x2 == x1)) { tmp_val[0] = '\0'; } else { sprintf(tmp_val, "%s%s of", ! ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""), ! ((x2 < x1) ? " West" : (x2 > x1) ? " East" : "")); } ! /* Prepare to ask which way to look */ ! sprintf(out_val, ! "Map sector [%d,%d], which is%s your sector. Direction?", ! (y2 / PANEL_HGT), (x2 / PANEL_WID), tmp_val); ! ! /* More detail */ if (center_player) { sprintf(out_val, "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?", ! (y2 / PANEL_HGT), (y2 % PANEL_HGT), ! (x2 / PANEL_WID), (x2 % PANEL_WID), tmp_val); } /* Assume no direction */ dir = 0; --- 947,996 ---- */ void do_cmd_locate(void) { ! int old_wy = p_ptr->wy; ! int old_wx = p_ptr->wx; ! /* Show panels until done */ ! while (1) ! { ! int wy = p_ptr->wy; ! int wx = p_ptr->wx; ! char tmp_val[80]; + char out_val[160]; + + int dir; /* Describe the location */ ! if ((wy == old_wy) && (wx == old_wx)) { tmp_val[0] = '\0'; } else { sprintf(tmp_val, "%s%s of", ! ((wy < old_wy) ? " North" : (wy > old_wy) ? " South" : ""), ! ((wx < old_wx) ? " West" : (wx > old_wx) ? " East" : "")); } ! /* Describe the panel */ if (center_player) { sprintf(out_val, "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?", ! (wy / PANEL_HGT), (wy % PANEL_HGT), ! (wx / PANEL_WID), (wx % PANEL_WID), tmp_val); } + else + { + /* Prepare to ask which way to look */ + sprintf(out_val, + "Map sector [%d,%d], which is%s your sector. Direction?", + (wy / PANEL_HGT), (wx / PANEL_WID), tmp_val); + } + /* Assume no direction */ dir = 0; *************** *** 1008,1038 **** /* No direction */ if (!dir) break; - /* Apply the motion */ - y2 += (ddy[dir] * PANEL_HGT); - x2 += (ddx[dir] * PANEL_WID); - - /* Verify the row */ - if (y2 < 0) y2 = 0; - if (y2 > DUNGEON_HGT - SCREEN_HGT) y2 = DUNGEON_HGT - SCREEN_HGT; - - /* Verify the col */ - if (x2 < 0) x2 = 0; - if (x2 > DUNGEON_WID - SCREEN_WID) x2 = DUNGEON_WID - SCREEN_WID; - /* Handle "changes" */ ! if ((p_ptr->wy != y2) || (p_ptr->wx != x2)) { - /* Update panel */ - p_ptr->wy = y2; - p_ptr->wx = x2; - - /* Redraw map */ - p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ - p_ptr->window |= (PW_OVERHEAD); - /* Handle stuff */ handle_stuff(); } --- 1013,1021 ---- /* No direction */ if (!dir) break; /* Handle "changes" */ ! if (change_panel(dir)) { /* Handle stuff */ handle_stuff(); } Only in angband-290/src: cmd3.o Only in angband-290/src: cmd4.o Only in angband-290/src: cmd5.o Only in angband-290/src: cmd6.o diff -r -c angband-290-src/src/config.h angband-290/src/config.h *** angband-290-src/src/config.h Mon Apr 10 01:42:31 2000 --- angband-290/src/config.h Sun Apr 23 19:58:22 2000 *************** *** 255,266 **** /* - * OPTION: Allow scrolling while targetting. - */ - #define ALLOW_SCROLL_TARGET - - - /* * OPTION: Delay the loading of the "f_text" array until it is actually * needed, saving ~1K, since "feature" descriptions are unused. */ --- 255,260 ---- *************** *** 493,510 **** * OPTION: Default font (when using X11). */ #define DEFAULT_X11_FONT "9x15" - - /* - * OPTION: Default fonts (when using X11) - */ - #define DEFAULT_X11_FONT_0 "10x20" - #define DEFAULT_X11_FONT_1 "9x15" - #define DEFAULT_X11_FONT_2 "9x15" - #define DEFAULT_X11_FONT_3 "5x8" - #define DEFAULT_X11_FONT_4 "5x8" - #define DEFAULT_X11_FONT_5 "5x8" - #define DEFAULT_X11_FONT_6 "5x8" - #define DEFAULT_X11_FONT_7 "5x8" /* --- 487,492 ---- Only in angband-290/src: dungeon.o diff -r -c angband-290-src/src/externs.h angband-290/src/externs.h *** angband-290-src/src/externs.h Mon Apr 10 01:42:31 2000 --- angband-290/src/externs.h Sun Apr 23 21:45:55 2000 *************** *** 714,719 **** --- 714,722 ---- extern void lose_exp(s32b amount); extern void monster_death(int m_idx); extern bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note); + extern bool modify_panel(int wy, int wx); + extern bool adjust_panel(int y, int x); + extern bool change_panel(int dir); extern void verify_panel(void); extern cptr look_mon_desc(int m_idx); extern void ang_sort_aux(vptr u, vptr v, int p, int q); Only in angband-290/src: files.o Only in angband-290/src: generate.o Only in angband-290/src: init1.o Only in angband-290/src: init2.o Only in angband-290/src: init3.o Only in angband-290/src: load1.o Only in angband-290/src: load2.o Only in angband-290/src: main-cap.o Only in angband-290/src: main-gcu.o diff -r -c angband-290-src/src/main-x11.c angband-290/src/main-x11.c *** angband-290-src/src/main-x11.c Mon Apr 10 01:42:29 2000 --- angband-290/src/main-x11.c Tue Apr 25 00:32:30 2000 *************** *** 1050,1055 **** --- 1050,1057 ---- * If 'name' is NULL, but 'dpy' is set, extract name from dpy * If 'dpy' is NULL, then Create the named Display * If 'name' is NULL, and so is 'dpy', use current Display + * + * Return -1 if no Display given, and none can be opened. */ static errr Metadpy_init_2(Display *dpy, cptr name) { *************** *** 1064,1097 **** dpy = XOpenDisplay(name); /* Failure */ ! if (!dpy) ! { ! ! #if 0 ! ! /* No name given, extract DISPLAY */ ! if (!name) name = getenv("DISPLAY"); ! ! /* No DISPLAY extracted, use default */ ! if (!name) name = "(default)"; ! ! /* Oops */ ! plog_fmt("Cannot open display '%s'", name); ! #endif ! ! /* Error */ ! return (-1); ! } ! ! /* We WILL have to Nuke it when done */ m->nuke = 1; } /* Since the Display was given, use it */ else { ! /* We will NOT have to Nuke it when done */ m->nuke = 0; } --- 1066,1081 ---- dpy = XOpenDisplay(name); /* Failure */ ! if (!dpy) return (-1); ! /* We will have to nuke it when done */ m->nuke = 1; } /* Since the Display was given, use it */ else { ! /* We will not have to nuke it when done */ m->nuke = 0; } *************** *** 1353,1358 **** --- 1337,1343 ---- #else */ dad = Metadpy->root; /* #endif */ + /* Create the Window XXX Error Check */ xid = XCreateSimpleWindow(Metadpy->dpy, dad, x, y, w, h, b, fg, bg); *************** *** 1444,1449 **** --- 1429,1436 ---- return (0); } + #endif /* IGNORE_UNUSED_FUNCTIONS */ + /* * Request that Infowin be moved to a new location *************** *** 1457,1464 **** return (0); } - #endif /* IGNORE_UNUSED_FUNCTIONS */ - /* * Resize an infowin --- 1444,1449 ---- *************** *** 1522,1603 **** /* - * Set the size hints of Infowin - */ - static errr Infowin_set_size(int w, int h, int r_w, int r_h, bool fixed) - { - XSizeHints *sh; - - /* Make Size Hints */ - sh = XAllocSizeHints(); - - /* Oops */ - if (!sh) return (1); - - /* Fixed window size */ - if (fixed) - { - sh->flags = PMinSize | PMaxSize; - sh->min_width = sh->max_width = w; - sh->min_height = sh->max_height = h; - } - - /* Variable window size */ - else - { - sh->flags = PMinSize; - sh->min_width = r_w + 2; - sh->min_height = r_h + 2; - } - - /* Standard fields */ - sh->width = w; - sh->height = h; - sh->width_inc = r_w; - sh->height_inc = r_h; - sh->base_width = 2; - sh->base_height = 2; - - /* Useful settings */ - sh->flags |= PSize | PResizeInc | PBaseSize; - - /* Use the size hints */ - XSetWMNormalHints(Metadpy->dpy, Infowin->win, sh); - - /* Success */ - return 0; - } - - - /* - * Set the name (in the title bar) of Infowin - */ - static errr Infowin_set_class_hint(cptr name) - { - XClassHint *ch; - - char res_name[20]; - char res_class[20]; - - ch = XAllocClassHint(); - if (ch == NULL) return (1); - - strcpy(res_name, name); - res_name[0] = FORCELOWER(res_name[0]); - ch->res_name = res_name; - - strcpy(res_class, "Angband"); - ch->res_class = res_class; - - XSetClassHint(Metadpy->dpy, Infowin->win, ch); - - return (0); - } - - - - - /* * A NULL terminated pair list of legal "operation names" * * Pairs of values, first is texttual name, second is the string --- 1507,1512 ---- *************** *** 2170,2175 **** --- 2079,2092 ---- /* + * The internal border size + */ + #define BORDER1 1 + #define BORDER2 (BORDER1 + BORDER1) + + + + /* * Process a keypress event * * Also appears in "main-xaw.c". *************** *** 2295,2303 **** term_data *td = NULL; infowin *iwin = NULL; ! int flag = 0; ! ! int i, x, y, z; /* Do not wait unless requested */ --- 2212,2218 ---- term_data *td = NULL; infowin *iwin = NULL; ! int i, x, y; /* Do not wait unless requested */ *************** *** 2349,2364 **** /* Switch on the Type */ switch (xev->type) { - /* A Button Press Event */ - case ButtonPress: - { - /* Set flag, then fall through */ - flag = 1; - } ! /* A Button Release (or ButtonPress) Event */ case ButtonRelease: { /* Which button is involved */ if (xev->xbutton.button == Button1) z = 1; else if (xev->xbutton.button == Button2) z = 2; --- 2264,2277 ---- /* Switch on the Type */ switch (xev->type) { ! #if 0 ! ! case ButtonPress: case ButtonRelease: { + int z = 0; + /* Which button is involved */ if (xev->xbutton.button == Button1) z = 1; else if (xev->xbutton.button == Button2) z = 2; *************** *** 2375,2388 **** break; } - /* An Enter Event */ case EnterNotify: - { - /* Note the Enter, Fall into 'Leave' */ - flag = 1; - } - - /* A Leave (or Enter) Event */ case LeaveNotify: { /* Where is the mouse */ --- 2288,2294 ---- *************** *** 2394,2400 **** break; } - /* A Motion Event */ case MotionNotify: { /* Where is the mouse */ --- 2300,2305 ---- *************** *** 2406,2419 **** break; } - /* A KeyRelease */ case KeyRelease: { /* Nothing */ break; } ! /* A KeyPress */ case KeyPress: { /* Save the mouse location */ --- 2311,2324 ---- break; } case KeyRelease: { /* Nothing */ break; } ! #endif ! case KeyPress: { /* Save the mouse location */ *************** *** 2429,2435 **** break; } - /* An Expose Event */ case Expose: { /* Ignore "extra" exposes */ --- 2334,2339 ---- *************** *** 2444,2487 **** break; } - /* A Mapping Event */ case MapNotify: { Infowin->mapped = 1; break; } - /* An UnMap Event */ case UnmapNotify: { - /* Save the mapped-ness */ Infowin->mapped = 0; break; } ! /* A Move AND/OR Resize Event */ case ConfigureNotify: { - int x1, y1, w1, h1; int cols, rows, wid, hgt; - /* Save the Old information */ - x1 = Infowin->x; - y1 = Infowin->y; - w1 = Infowin->w; - h1 = Infowin->h; - /* Save the new Window Parms */ Infowin->x = xev->xconfigure.x; Infowin->y = xev->xconfigure.y; Infowin->w = xev->xconfigure.width; Infowin->h = xev->xconfigure.height; ! /* Detemine "proper" number of rows/cols */ ! cols = ((Infowin->w - 2) / td->fnt->wid); ! rows = ((Infowin->h - 2) / td->fnt->hgt); ! /* Hack -- do not allow resize of main screen */ if (td == &data[0]) cols = 80; if (td == &data[0]) rows = 24; --- 2348,2386 ---- break; } case MapNotify: { Infowin->mapped = 1; + Term->mapped_flag = TRUE; break; } case UnmapNotify: { Infowin->mapped = 0; + Term->mapped_flag = FALSE; break; } ! /* Move and/or Resize */ case ConfigureNotify: { int cols, rows, wid, hgt; /* Save the new Window Parms */ Infowin->x = xev->xconfigure.x; Infowin->y = xev->xconfigure.y; Infowin->w = xev->xconfigure.width; Infowin->h = xev->xconfigure.height; ! /* Analyze outer window only */ ! if (iwin != td->outer) break; ! /* Determine "proper" number of rows/cols */ ! cols = ((Infowin->w - BORDER2) / td->fnt->wid); ! rows = ((Infowin->h - BORDER2) / td->fnt->hgt); ! ! /* Paranoia */ if (td == &data[0]) cols = 80; if (td == &data[0]) rows = 24; *************** *** 2489,2503 **** if (cols < 1) cols = 1; if (rows < 1) rows = 1; ! /* Desired size of "outer" window */ wid = cols * td->fnt->wid; hgt = rows * td->fnt->hgt; /* Resize the windows if any "change" is needed */ ! if ((Infowin->w != wid + 2) || (Infowin->h != hgt + 2)) { Infowin_set(td->outer); ! Infowin_resize(wid + 2, hgt + 2); Infowin_set(td->inner); Infowin_resize(wid, hgt); } --- 2388,2409 ---- if (cols < 1) cols = 1; if (rows < 1) rows = 1; ! /* Desired size of "inner" window */ wid = cols * td->fnt->wid; hgt = rows * td->fnt->hgt; + /* Resize the Term (if needed) */ + Term_resize(cols, rows); + /* Resize the windows if any "change" is needed */ ! if ((Infowin->w != wid + BORDER2) || ! (Infowin->h != hgt + BORDER2)) { + /* Resize outer window */ Infowin_set(td->outer); ! Infowin_resize(wid + BORDER2, hgt + BORDER2); ! ! /* Resize inner window */ Infowin_set(td->inner); Infowin_resize(wid, hgt); } *************** *** 2514,2522 **** Infowin_set(old_td->inner); - /* XXX XXX Hack -- map/unmap as needed */ - - /* Success */ return (0); } --- 2420,2425 ---- *************** *** 2613,2619 **** /* Delay for some milliseconds */ case TERM_XTRA_DELAY: usleep(1000 * v); return (0); ! /* React to changes XXX XXX XXX */ case TERM_XTRA_REACT: return (Term_xtra_x11_react()); } --- 2516,2522 ---- /* Delay for some milliseconds */ case TERM_XTRA_DELAY: usleep(1000 * v); return (0); ! /* React to changes */ case TERM_XTRA_REACT: return (Term_xtra_x11_react()); } *************** *** 2623,2629 **** /* ! * Draw the cursor (XXX by hiliting) */ static errr Term_curs_x11(int x, int y) { --- 2526,2534 ---- /* ! * Draw the cursor as an inverted rectangle. ! * ! * Consider a rectangular outline like "main-mac.c". XXX XXX */ static errr Term_curs_x11(int x, int y) { *************** *** 2714,2725 **** /* * Initialize a term_data */ ! static errr term_data_init(term_data *td, bool fixed, cptr name, cptr font) { term *t = &td->t; int wid, hgt, num; /* Prepare the standard font */ MAKE(td->fnt, infofnt); Infofnt_set(td->fnt); --- 2619,2685 ---- /* * Initialize a term_data */ ! static errr term_data_init(term_data *td, int i) { term *t = &td->t; + bool fixed = (i == 0); + + cptr name = angband_term_name[i]; + + cptr font; + + int x = 0; + int y = 0; + + int cols = 80; + int rows = 24; + int wid, hgt, num; + char buf[80]; + + cptr str; + + int val; + + XClassHint *ch; + + char res_name[20]; + char res_class[20]; + + XSizeHints *sh; + + + /* Window specific font name */ + sprintf(buf, "ANGBAND_X11_FONT_%d", i); + + /* Check environment for that font */ + font = getenv(buf); + + /* Check environment for "base" font */ + if (!font) font = getenv("ANGBAND_X11_FONT"); + + /* No environment variables, use default font */ + if (!font) font = DEFAULT_X11_FONT; + + + if (!fixed) + { + /* Window specific cols */ + sprintf(buf, "ANGBAND_X11_COLS_%d", i); + str = getenv(buf); + val = (str != NULL) ? atoi(str) : -1; + if (val > 0) cols = val; + + /* Window specific rows */ + sprintf(buf, "ANGBAND_X11_ROWS_%d", i); + str = getenv(buf); + val = (str != NULL) ? atoi(str) : -1; + if (val > 0) rows = val; + } + + /* Prepare the standard font */ MAKE(td->fnt, infofnt); Infofnt_set(td->fnt); *************** *** 2729,2761 **** num = (fixed ? 1024 : 16); /* Assume full size windows */ ! wid = 80 * td->fnt->wid; ! hgt = 24 * td->fnt->hgt; /* Create a top-window */ MAKE(td->outer, infowin); Infowin_set(td->outer); ! Infowin_init_top(0, 0, wid + 2, hgt + 2, 1, Metadpy->fg, Metadpy->bg); Infowin_set_mask(StructureNotifyMask | KeyPressMask); Infowin_set_name(name); ! Infowin_set_class_hint(name); ! Infowin_set_size(wid+2, hgt+2, td->fnt->wid, td->fnt->hgt, fixed); Infowin_map(); /* Create a sub-window */ MAKE(td->inner, infowin); Infowin_set(td->inner); ! Infowin_init_std(td->outer, 1, 1, wid, hgt, 0); Infowin_set_mask(ExposureMask); Infowin_map(); #ifdef USE_GRAPHICS /* No graphics yet */ td->tiles = NULL; #endif /* USE_GRAPHICS */ /* Initialize the term */ ! term_init(t, 80, 24, num); /* Use a "soft" cursor */ t->soft_cursor = TRUE; --- 2689,2790 ---- num = (fixed ? 1024 : 16); /* Assume full size windows */ ! wid = cols * td->fnt->wid; ! hgt = rows * td->fnt->hgt; /* Create a top-window */ MAKE(td->outer, infowin); Infowin_set(td->outer); ! Infowin_init_top(x, y, wid + BORDER2, hgt + BORDER2, 0, ! Metadpy->fg, Metadpy->bg); Infowin_set_mask(StructureNotifyMask | KeyPressMask); Infowin_set_name(name); ! ! /* Make Class Hints */ ! ch = XAllocClassHint(); ! ! if (ch == NULL) quit("XAllocClassHint failed"); ! ! strcpy(res_name, name); ! res_name[0] = FORCELOWER(res_name[0]); ! ch->res_name = res_name; ! ! strcpy(res_class, "Angband"); ! ch->res_class = res_class; ! ! XSetClassHint(Metadpy->dpy, Infowin->win, ch); ! ! /* Make Size Hints */ ! sh = XAllocSizeHints(); ! ! /* Oops */ ! if (sh == NULL) quit("XAllocSizeHints failed"); ! ! /* Fixed window size */ ! if (fixed) ! { ! /* Minimum/Maximum size */ ! sh->flags = PMinSize | PMaxSize; ! sh->min_width = sh->max_width = wid + BORDER2; ! sh->min_height = sh->max_height = hgt + BORDER2; ! } ! ! /* Variable window size */ ! else ! { ! /* Minimum size */ ! sh->flags = PMinSize; ! sh->min_width = td->fnt->wid + BORDER2; ! sh->min_height = td->fnt->hgt + BORDER2; ! } ! ! /* Resize increment */ ! sh->flags |= PResizeInc; ! sh->width_inc = td->fnt->wid; ! sh->height_inc = td->fnt->hgt; ! ! /* Base window size */ ! sh->flags |= PBaseSize; ! sh->base_width = BORDER2; ! sh->base_height = BORDER2; ! ! /* Use the size hints */ ! XSetWMNormalHints(Metadpy->dpy, Infowin->win, sh); ! ! /* Map the window */ Infowin_map(); + /* Window specific cols */ + sprintf(buf, "ANGBAND_X11_AT_X_%d", i); + str = getenv(buf); + x = (str != NULL) ? atoi(str) : -1; + + /* Window specific rows */ + sprintf(buf, "ANGBAND_X11_AT_Y_%d", i); + str = getenv(buf); + y = (str != NULL) ? atoi(str) : -1; + + /* Move the window to that location */ + if ((x >= 0) && (y >= 0)) Infowin_impell(x, y); + /* Create a sub-window */ MAKE(td->inner, infowin); Infowin_set(td->inner); ! Infowin_init_std(td->outer, BORDER1, BORDER1, wid, hgt, 0); Infowin_set_mask(ExposureMask); + + /* Map the window */ Infowin_map(); #ifdef USE_GRAPHICS + /* No graphics yet */ td->tiles = NULL; + #endif /* USE_GRAPHICS */ /* Initialize the term */ ! term_init(t, cols, rows, num); /* Use a "soft" cursor */ t->soft_cursor = TRUE; *************** *** 2920,2998 **** { term_data *td = &data[i]; - cptr fnt_name = NULL; - - cptr name = angband_term_name[i]; - - /* Window specific font name */ - sprintf(buf, "ANGBAND_X11_FONT_%s", name); - - /* Check environment for that font */ - if (!fnt_name) fnt_name = getenv(buf); - - /* Window specific font name */ - sprintf(buf, "ANGBAND_X11_FONT_%d", i); - - /* Check environment for that font */ - if (!fnt_name) fnt_name = getenv(buf); - - /* Check environment for "base" font */ - if (!fnt_name) fnt_name = getenv("ANGBAND_X11_FONT"); - - /* No environment variables, use default font */ - if (!fnt_name) - { - switch (i) - { - case 0: - { - fnt_name = DEFAULT_X11_FONT_0; - } - break; - case 1: - { - fnt_name = DEFAULT_X11_FONT_1; - } - break; - case 2: - { - fnt_name = DEFAULT_X11_FONT_2; - } - break; - case 3: - { - fnt_name = DEFAULT_X11_FONT_3; - } - break; - case 4: - { - fnt_name = DEFAULT_X11_FONT_4; - } - break; - case 5: - { - fnt_name = DEFAULT_X11_FONT_5; - } - break; - case 6: - { - fnt_name = DEFAULT_X11_FONT_6; - } - break; - case 7: - { - fnt_name = DEFAULT_X11_FONT_7; - } - break; - default: - { - fnt_name = DEFAULT_X11_FONT; - } - } - } - /* Initialize the term_data */ ! term_data_init(td, TRUE, name, fnt_name); /* Save global entry */ angband_term[i] = Term; --- 2949,2956 ---- { term_data *td = &data[i]; /* Initialize the term_data */ ! term_data_init(td, i); /* Save global entry */ angband_term[i] = Term; *************** *** 3006,3013 **** { XImage *tiles_raw; - - /* Load the graphics XXX XXX XXX */ tiles_raw = ReadBMP(Metadpy->dpy, filename); --- 2964,2969 ---- *************** *** 3063,3065 **** --- 3019,3022 ---- } #endif /* USE_X11 */ + Only in angband-290/src: main-x11.o Only in angband-290/src: main-xaw.o Only in angband-290/src: main.o Only in angband-290/src: melee1.o Only in angband-290/src: melee2.o Only in angband-290/src: monster1.o Only in angband-290/src: monster2.o Only in angband-290/src: object1.o Only in angband-290/src: object2.o Only in angband-290/src: save.o Only in angband-290/src: spells1.o Only in angband-290/src: spells2.o Only in angband-290/src: store.o Only in angband-290/src: tables.o Only in angband-290/src: util.o Only in angband-290/src: variable.o Only in angband-290/src: wizard1.o Only in angband-290/src: wizard2.o Only in angband-290/src: xtra1.o diff -r -c angband-290-src/src/xtra2.c angband-290/src/xtra2.c *** angband-290-src/src/xtra2.c Mon Apr 10 01:42:30 2000 --- angband-290/src/xtra2.c Sun Apr 23 22:00:49 2000 *************** *** 2241,2388 **** return (FALSE); } /* ! * Handle a request to change the current panel * ! * Return TRUE if the panel was changed. */ ! static bool change_panel(int dir) { ! int y = p_ptr->wy + ddy[dir] * PANEL_HGT; ! int x = p_ptr->wx + ddx[dir] * PANEL_WID; ! ! /* Verify the row */ ! if (y < 0) y = 0; ! if (y > DUNGEON_HGT - SCREEN_HGT) y = DUNGEON_HGT - SCREEN_HGT; ! ! /* Verify the col */ ! if (x < 0) x = 0; ! if (x > DUNGEON_WID - SCREEN_WID) x = DUNGEON_WID - SCREEN_WID; ! ! /* Handle "changes" */ ! if ((p_ptr->wy != y) || (p_ptr->wx != x)) ! { ! /* Update panel */ ! p_ptr->wy = y; ! p_ptr->wx = x; ! ! /* Update stuff */ ! p_ptr->update |= (PU_MONSTERS); /* Redraw map */ p_ptr->redraw |= (PR_MAP); ! /* Handle stuff */ ! handle_stuff(); ! /* Success */ ! return TRUE; } /* No change */ ! return FALSE; } /* ! * Check for, and react to, the player leaving the panel * ! * When the player gets too close to the edge of a panel, the ! * map scrolls one panel in that direction so that the player * is no longer so close to the edge. */ void verify_panel(void) { int py = p_ptr->py; int px = p_ptr->px; ! int i; - bool scroll = FALSE; ! ! /* Initial row */ ! i = p_ptr->wy; ! ! /* Scroll screen when off-center */ if (center_player && (!p_ptr->running || !run_avoid_center) && ! (py != p_ptr->wy + SCREEN_HGT / 2)) ! { ! i = py - SCREEN_HGT / 2; ! if (i < 0) i = 0; ! if (i > DUNGEON_HGT - SCREEN_HGT) i = DUNGEON_HGT - SCREEN_HGT; ! } ! ! /* Scroll screen when 2 grids from top/bottom edge */ ! else if ((py < p_ptr->wy + 2) || (py >= p_ptr->wy + SCREEN_HGT - 2)) { ! i = ((py - PANEL_HGT / 2) / PANEL_HGT) * PANEL_HGT; ! if (i < 0) i = 0; ! if (i > DUNGEON_HGT - SCREEN_HGT) i = DUNGEON_HGT - SCREEN_HGT; } ! /* Hack -- handle town */ ! if (!p_ptr->depth) i = SCREEN_HGT; ! ! /* New panel row */ ! if (p_ptr->wy != i) { ! /* Update panel */ ! p_ptr->wy = i; ! ! /* Scroll */ ! scroll = TRUE; } ! /* Initial col */ ! i = p_ptr->wx; ! ! /* Scroll screen when off-center */ if (center_player && (!p_ptr->running || !run_avoid_center) && ! (px != p_ptr->wx + SCREEN_WID / 2)) ! { ! i = px - SCREEN_WID / 2; ! if (i < 0) i = 0; ! if (i > DUNGEON_WID - SCREEN_WID) i = DUNGEON_WID - SCREEN_WID; ! } ! ! /* Scroll screen when 4 grids from left/right edge */ ! else if ((px < p_ptr->wx + 4) || (px >= p_ptr->wx + SCREEN_WID - 4)) { ! i = ((px - PANEL_WID / 2) / PANEL_WID) * PANEL_WID; ! if (i < 0) i = 0; ! if (i > DUNGEON_WID - SCREEN_WID) i = DUNGEON_WID - SCREEN_WID; } ! /* Hack -- handle town */ ! if (!p_ptr->depth) i = SCREEN_WID; ! ! /* New panel col */ ! if (p_ptr->wx != i) { ! /* Update panel */ ! p_ptr->wx = i; ! ! /* Scroll */ ! scroll = TRUE; } ! /* Scroll */ ! if (scroll) { /* Optional disturb on "panel change" */ if (disturb_panel && !center_player) disturb(0, 0); - - /* Redraw map */ - p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ - p_ptr->window |= (PW_OVERHEAD); } } --- 2241,2383 ---- return (FALSE); } + /* ! * Modify the current panel to the given coordinates, adjusting only to ! * ensure the coordinates are legal, and return TRUE if anything done. * ! * Hack -- The town should never be scrolled around. ! * ! * Note that monsters are no longer affected in any way by panel changes. ! * ! * As a total hack, whenever the current panel changes, we assume that ! * the "overhead view" window should be updated. */ ! bool modify_panel(int wy, int wx) { ! /* Verify wy, adjust if needed */ ! if (p_ptr->depth == 0) wy = SCREEN_HGT; ! else if (wy > DUNGEON_HGT - SCREEN_HGT) wy = DUNGEON_HGT - SCREEN_HGT; ! else if (wy < 0) wy = 0; ! ! /* Verify wx, adjust if needed */ ! if (p_ptr->depth == 0) wx = SCREEN_WID; ! else if (wx > DUNGEON_WID - SCREEN_WID) wx = DUNGEON_WID - SCREEN_WID; ! else if (wx < 0) wx = 0; ! ! /* React to changes */ ! if ((p_ptr->wy != wy) || (p_ptr->wx != wx)) ! { ! /* Save wy, wx */ ! p_ptr->wy = wy; ! p_ptr->wx = wx; /* Redraw map */ p_ptr->redraw |= (PR_MAP); ! /* Hack -- Window stuff */ ! p_ptr->window |= (PW_OVERHEAD); ! /* Changed */ ! return (TRUE); } /* No change */ ! return (FALSE); } + /* + * Perform the minimum "whole panel" adjustment to ensure that the given + * location is contained inside the current panel, and return TRUE if any + * such adjustment was performed. + */ + bool adjust_panel(int y, int x) + { + int wy = p_ptr->wy; + int wx = p_ptr->wx; + /* Adjust as needed */ + while (y >= wy + SCREEN_HGT) wy += SCREEN_HGT; + while (y < wy) wy -= SCREEN_HGT; + + /* Adjust as needed */ + while (x >= wx + SCREEN_WID) wx += SCREEN_WID; + while (x < wx) wx -= SCREEN_WID; + + /* Use "modify_panel" */ + return (modify_panel(wy, wx)); + } + + + /* + * Change the current panel to the panel lying in the given direction. + * + * Return TRUE if the panel was changed. + */ + bool change_panel(int dir) + { + int wy = p_ptr->wy + ddy[dir] * PANEL_HGT; + int wx = p_ptr->wx + ddx[dir] * PANEL_WID; + + /* Use "modify_panel" */ + return (modify_panel(wy, wx)); + } /* ! * Verify the current panel (relative to the player location). * ! * By default, when the player gets "too close" to the edge of the current ! * panel, the map scrolls one panel in that direction so that the player * is no longer so close to the edge. + * + * The "center_player" option allows the current panel to always be centered + * around the player, which is very expensive, and also has some interesting + * gameplay ramifications. */ void verify_panel(void) { int py = p_ptr->py; int px = p_ptr->px; ! int wy = p_ptr->wy; ! int wx = p_ptr->wx; ! /* Scroll screen vertically when off-center */ if (center_player && (!p_ptr->running || !run_avoid_center) && ! (py != wy + SCREEN_HGT / 2)) { ! wy = py - SCREEN_HGT / 2; } ! /* Scroll screen vertically when 2 grids from top/bottom edge */ ! else if ((py < wy + 2) || (py >= wy + SCREEN_HGT - 2)) { ! wy = ((py - PANEL_HGT / 2) / PANEL_HGT) * PANEL_HGT; } ! /* Scroll screen horizontally when off-center */ if (center_player && (!p_ptr->running || !run_avoid_center) && ! (px != wx + SCREEN_WID / 2)) { ! wx = px - SCREEN_WID / 2; } ! /* Scroll screen horizontally when 4 grids from left/right edge */ ! else if ((px < wx + 4) || (px >= wx + SCREEN_WID - 4)) { ! wx = ((px - PANEL_WID / 2) / PANEL_WID) * PANEL_WID; } ! /* Scroll if needed */ ! if (modify_panel(wy, wx)) { /* Optional disturb on "panel change" */ if (disturb_panel && !center_player) disturb(0, 0); } } *************** *** 2935,2943 **** temp_n = 0; /* Scan the current panel */ ! for (y = p_ptr->wy; y < p_ptr->wy+SCREEN_HGT; y++) { ! for (x = p_ptr->wx; x < p_ptr->wx+SCREEN_WID; x++) { /* Require line of sight, unless "look" is "expanded" */ if (!expand_look && !player_has_los_bold(y, x)) continue; --- 2930,2938 ---- temp_n = 0; /* Scan the current panel */ ! for (y = p_ptr->wy; y < p_ptr->wy + SCREEN_HGT; y++) { ! for (x = p_ptr->wx; x < p_ptr->wx + SCREEN_WID; x++) { /* Require line of sight, unless "look" is "expanded" */ if (!expand_look && !player_has_los_bold(y, x)) continue; *************** *** 3368,3378 **** * * Note that this code can be called from "get_aim_dir()". * ! * All locations must be on the current panel. XXX XXX XXX ! * ! * Perhaps consider the possibility of "auto-scrolling" the screen ! * while the cursor moves around. This may require dynamic updating ! * of the "temp" grid set. XXX XXX XXX * * Hack -- targetting/observing an "outer border grid" may induce * problems, so this is not currently allowed. --- 3363,3377 ---- * * Note that this code can be called from "get_aim_dir()". * ! * All locations must be on the current panel, unless the "scroll_target" ! * option is used, which allows changing the current panel during "look" ! * and "target" commands. Currently, when "flag" is true, that is, when ! * "interesting" grids are being used, and a directional key is used, we ! * only scroll by a single panel, in the direction requested, and check ! * for any interesting grids on that panel. The "correct" solution would ! * actually involve scanning a larger set of grids, including ones in ! * panels which are adjacent to the one currently scanned, but this is ! * overkill for this function. XXX XXX * * Hack -- targetting/observing an "outer border grid" may induce * problems, so this is not currently allowed. *************** *** 3499,3527 **** case 'p': { - - #ifdef ALLOW_SCROLL_TARGET - if (scroll_target) { ! /* Recenter the map around the player */ verify_panel(); - /* Update stuff */ - p_ptr->update |= (PU_MONSTERS); - - /* Redraw map */ - p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ - p_ptr->window |= (PW_OVERHEAD); - /* Handle stuff */ handle_stuff(); } - #endif /* ALLOW_SCROLL_TARGET */ - y = py; x = px; } --- 3498,3512 ---- case 'p': { if (scroll_target) { ! /* Recenter around player */ verify_panel(); /* Handle stuff */ handle_stuff(); } y = py; x = px; } *************** *** 3572,3664 **** /* Hack -- move around */ if (d) { ! ! #ifdef ALLOW_SCROLL_TARGET ! ! int y2 = p_ptr->wy; ! int x2 = p_ptr->wx; ! ! #endif /* ALLOW_SCROLL_TARGET */ /* Find a new monster */ ! i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]); ! ! #ifdef ALLOW_SCROLL_TARGET ! /* Request to target past last interesting grid */ ! while (scroll_target && flag && (i < 0)) { ! /* Note the change */ if (change_panel(d)) { - int v = temp_y[m]; - int u = temp_x[m]; - /* Recalculate interesting grids */ target_set_interactive_prepare(mode); - /* Look at interesting grids */ - flag = TRUE; - /* Find a new monster */ ! i = target_pick(v, u, ddy[d], ddx[d]); ! ! /* Use that grid */ ! if (i >= 0) m = i; ! } ! ! /* Nothing interesting */ ! else ! { ! /* Restore previous position */ ! p_ptr->wy = y2; ! p_ptr->wx = x2; ! ! /* Update stuff */ ! p_ptr->update |= (PU_MONSTERS); ! /* Redraw map */ ! p_ptr->redraw |= (PR_MAP); ! /* Window stuff */ ! p_ptr->window |= (PW_OVERHEAD); /* Handle stuff */ handle_stuff(); - - /* Recalculate interesting grids */ - target_set_interactive_prepare(mode); - - /* Look at boring grids */ - flag = FALSE; - - /* Move */ - x += ddx[d]; - y += ddy[d]; - - /* Apply the motion */ - if ((y >= p_ptr->wy + SCREEN_HGT) || (y < p_ptr->wy) || - (x >= p_ptr->wx + SCREEN_WID) || (x < p_ptr->wx)) - { - if (change_panel(d)) - { - target_set_interactive_prepare(mode); - } - } - - /* Slide into legality */ - if (x >= DUNGEON_WID-1) x = DUNGEON_WID - 2; - else if (x <= 0) x = 1; - - /* Slide into legality */ - if (y >= DUNGEON_HGT-1) y = DUNGEON_HGT - 2; - else if (y <= 0) y = 1; } } ! #endif /* ALLOW_SCROLL_TARGET */ ! ! /* Use that grid */ if (i >= 0) m = i; } } --- 3557,3597 ---- /* Hack -- move around */ if (d) { ! int old_y = temp_y[m]; ! int old_x = temp_x[m]; /* Find a new monster */ ! i = target_pick(old_y, old_x, ddy[d], ddx[d]); ! /* Scroll to find interesting grid */ ! if (scroll_target && (i < 0)) { ! int old_wy = p_ptr->wy; ! int old_wx = p_ptr->wx; ! ! /* Change if legal */ if (change_panel(d)) { /* Recalculate interesting grids */ target_set_interactive_prepare(mode); /* Find a new monster */ ! i = target_pick(old_y, old_x, ddy[d], ddx[d]); ! /* Restore panel if needed */ ! if ((i < 0) && modify_panel(old_wy, old_wx)) ! { ! /* Recalculate interesting grids */ ! target_set_interactive_prepare(mode); ! } /* Handle stuff */ handle_stuff(); } } ! /* Use interesting grid if found */ if (i >= 0) m = i; } } *************** *** 3698,3726 **** case 'p': { - - #ifdef ALLOW_SCROLL_TARGET - if (scroll_target) { ! /* Recenter the map around the player */ verify_panel(); - /* Update stuff */ - p_ptr->update |= (PU_MONSTERS); - - /* Redraw map */ - p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ - p_ptr->window |= (PW_OVERHEAD); - /* Handle stuff */ handle_stuff(); } - #endif /* ALLOW_SCROLL_TARGET */ - y = py; x = px; } --- 3631,3645 ---- case 'p': { if (scroll_target) { ! /* Recenter around player */ verify_panel(); /* Handle stuff */ handle_stuff(); } y = py; x = px; } *************** *** 3785,3807 **** x += ddx[d]; y += ddy[d]; ! /* Apply the motion */ ! if ((y >= p_ptr->wy + SCREEN_HGT) || (y < p_ptr->wy) || ! (x >= p_ptr->wx + SCREEN_WID) || (x < p_ptr->wx)) { ! if (change_panel(d)) { target_set_interactive_prepare(mode); } } ! /* Slide into legality */ ! if (x >= DUNGEON_WID-1) x = DUNGEON_WID - 2; ! else if (x <= 0) x = 1; ! ! /* Slide into legality */ ! if (y >= DUNGEON_HGT-1) y = DUNGEON_HGT - 2; ! else if (y <= 0) y = 1; } } } --- 3704,3740 ---- x += ddx[d]; y += ddy[d]; ! if (scroll_target) { ! /* Slide into legality */ ! if (x >= DUNGEON_WID - 1) x--; ! else if (x <= 0) x++; ! ! /* Slide into legality */ ! if (y >= DUNGEON_HGT - 1) y--; ! else if (y <= 0) y++; ! ! /* Adjust panel if needed */ ! if (adjust_panel(y, x)) { + /* Handle stuff */ + handle_stuff(); + + /* Recalculate interesting grids */ target_set_interactive_prepare(mode); } } ! else ! { ! /* Slide into legality */ ! if (x >= p_ptr->wx + SCREEN_WID) x--; ! else if (x < p_ptr->wx) x++; ! ! /* Slide into legality */ ! if (y >= p_ptr->wy + SCREEN_HGT) y--; ! else if (y < p_ptr->wy) y++; ! } } } } *************** *** 3812,3838 **** /* Clear the top line */ prt("", 0, 0); - #ifdef ALLOW_SCROLL_TARGET - if (scroll_target) { ! /* Recenter the map around the player */ verify_panel(); - /* Update stuff */ - p_ptr->update |= (PU_MONSTERS); - - /* Redraw map */ - p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ - p_ptr->window |= (PW_OVERHEAD); - /* Handle stuff */ handle_stuff(); } - - #endif /* ALLOW_SCROLL_TARGET */ /* Failure to set target */ if (!p_ptr->target_set) return (FALSE); --- 3745,3758 ---- /* Clear the top line */ prt("", 0, 0); if (scroll_target) { ! /* Recenter around player */ verify_panel(); /* Handle stuff */ handle_stuff(); } /* Failure to set target */ if (!p_ptr->target_set) return (FALSE); Only in angband-290/src: xtra2.o Only in angband-290/src: z-form.o Only in angband-290/src: z-rand.o Only in angband-290/src: z-term.o Only in angband-290/src: z-util.o Only in angband-290/src: z-virt.o