summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-24 11:32:39 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-24 11:32:39 +0000
commit0e45d433001ad595b04911a963a381728655d139 (patch)
tree163be231362006beb10c61b44dccf01a6ff7781b
parent59dd9db8ac1b4aad55b7b902c802003d9f3872c1 (diff)
downloadcrawl-ref-0e45d433001ad595b04911a963a381728655d139.tar.gz
crawl-ref-0e45d433001ad595b04911a963a381728655d139.zip
[1601205] */' now work to jump to stashes in the level-map. ; retains its old
behaviour of travel-to-cursor, which may disconcert folks used to its behaviour when targeting, but I suspect they'll get used to it. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@488 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/view.cc739
1 files changed, 368 insertions, 371 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 11aea1a7a0..8cc87ab02b 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -1875,8 +1875,10 @@ void find_features(const std::vector<coord_def>& features,
static int find_feature( const std::vector<coord_def>& features,
unsigned char feature, int curs_x, int curs_y,
int start_x, int start_y,
- int ignore_count, char *move_x, char *move_y) {
- int firstx = -1, firsty = -1;
+ int ignore_count,
+ char *move_x, char *move_y,
+ bool forward) {
+ int firstx = -1, firsty = -1, firstmatch = -1;
int matchcount = 0;
for (unsigned feat = 0; feat < features.size(); ++feat) {
@@ -1884,15 +1886,16 @@ static int find_feature( const std::vector<coord_def>& features,
if (is_feature(feature, coord.x, coord.y)) {
++matchcount;
- if (!ignore_count--) {
+ if (forward? !ignore_count-- : --ignore_count == 1) {
// We want to cursor to (x,y)
*move_x = coord.x - (start_x + curs_x);
*move_y = coord.y - (start_y + curs_y);
return matchcount;
}
- else if (firstx == -1) {
+ else if (!forward || firstx == -1) {
firstx = coord.x;
firsty = coord.y;
+ firstmatch = matchcount;
}
}
}
@@ -1901,7 +1904,7 @@ static int find_feature( const std::vector<coord_def>& features,
if (firstx != -1) {
*move_x = firstx - (start_x + curs_x);
*move_y = firsty - (start_y + curs_y);
- return 1;
+ return matchcount;
}
return 0;
}
@@ -1929,6 +1932,105 @@ static int cset_adjust(int raw)
}
#endif
+static void draw_level_map(
+ int start_x, int start_y, int screen_y, bool travel_mode)
+{
+ int bufcount2 = 0;
+ screen_buffer_t buffer2[GYM * GXM * 2];
+ const int num_lines = get_number_of_lines();
+
+ _setcursortype(_NOCURSOR);
+
+#ifdef PLAIN_TERM
+ gotoxy(1, 1);
+#endif
+
+ for (int j = 0; j < num_lines; j++)
+ {
+ for (int i = 0; i < 80; i++)
+ {
+ screen_buffer_t colour = DARKGREY;
+ if (start_y + j >= 65 || start_y + j <= 3
+ || start_x + i < 0 || start_x + i >= GXM - 1)
+ {
+ buffer2[bufcount2 + 1] = DARKGREY;
+ buffer2[bufcount2] = 0;
+ bufcount2 += 2;
+
+#ifdef PLAIN_TERM
+ goto print_it;
+#endif
+
+#ifdef DOS_TERM
+ continue;
+#endif
+ }
+
+ colour = colour_code_map(start_x + i, start_y + j,
+ Options.item_colour,
+ travel_mode && Options.travel_colour);
+
+ buffer2[bufcount2 + 1] = colour;
+ buffer2[bufcount2] =
+ (unsigned char) env.map[start_x + i][start_y + j];
+
+ if (start_x + i + 1 == you.x_pos && start_y + j + 1 == you.y_pos)
+ {
+ // [dshaligram] Draw the @ symbol on the level-map. It's no
+ // longer saved into the env.map, so we need to draw it
+ // directly.
+ buffer2[bufcount2 + 1] = WHITE;
+ buffer2[bufcount2] = you.symbol;
+ }
+
+ // If we've a waypoint on the current square, *and* the square is
+ // a normal floor square with nothing on it, show the waypoint
+ // number.
+ if (Options.show_waypoints)
+ {
+ // XXX: This is a horrible hack.
+ screen_buffer_t &bc = buffer2[bufcount2];
+ int gridx = start_x + i + 1, gridy = start_y + j + 1;
+ unsigned char ch = is_waypoint(gridx, gridy);
+ if (ch && (bc == get_sightmap_char(DNGN_FLOOR) ||
+ bc == get_magicmap_char(DNGN_FLOOR)))
+ bc = ch;
+ }
+
+ bufcount2 += 2;
+
+#ifdef PLAIN_TERM
+
+ print_it:
+ // avoid line wrap
+ if (i == 79)
+ continue;
+
+ // newline
+ if (i == 0 && j > 0)
+ gotoxy( 1, j + 1 );
+
+ int ch = buffer2[bufcount2 - 2];
+#ifdef USE_CURSES
+ ch = cset_adjust( ch );
+#endif
+ textcolor( buffer2[bufcount2 - 1] );
+ putch(ch);
+#endif
+ }
+ }
+
+#ifdef USE_CURSES
+ set_altcharset(false);
+#endif
+
+#ifdef DOS_TERM
+ puttext(1, 1, 80, 25, buffer2);
+#endif
+
+ _setcursortype(_NORMALCURSOR);
+}
+
// show_map() now centers the known map along x or y. This prevents
// the player from getting "artificial" location clues by using the
// map to see how close to the end they are. They'll need to explore
@@ -1937,8 +2039,6 @@ void show_map( FixedVector<int, 2> &spec_place, bool travel_mode )
{
int i, j;
- int bufcount2 = 0;
-
char move_x = 0;
char move_y = 0;
char getty = 0;
@@ -1958,9 +2058,6 @@ void show_map( FixedVector<int, 2> &spec_place, bool travel_mode )
arrange_features(features);
}
- // buffer2[GYM * GXM * 2] segfaults my box {dlb}
- screen_buffer_t buffer2[GYM * GXM * 2];
-
char min_x = 80, max_x = 0, min_y = 0, max_y = 0;
bool found_y = false;
@@ -1994,7 +2091,7 @@ void show_map( FixedVector<int, 2> &spec_place, bool travel_mode )
const int start_x = min_x + (max_x - min_x + 1) / 2 - 40; // no x scrolling
const int block_step = Options.level_map_cursor_step;
- int start_y; // y does scroll
+ int start_y = 0; // y does scroll
int screen_y = you.y_pos;
@@ -2017,6 +2114,9 @@ void show_map( FixedVector<int, 2> &spec_place, bool travel_mode )
int curs_y = you.y_pos - screen_y + half_screen;
int search_feat = 0, search_found = 0, anchor_x = -1, anchor_y = -1;
+ bool map_alive = true;
+ bool redraw_map = true;
+
#ifdef DOS_TERM
gettext(1, 1, 80, 25, buffer);
window(1, 1, 80, 25);
@@ -2025,415 +2125,312 @@ void show_map( FixedVector<int, 2> &spec_place, bool travel_mode )
clrscr();
textcolor(DARKGREY);
- put_screen:
- bufcount2 = 0;
+ while (map_alive)
+ {
+ start_y = screen_y - half_screen;
- _setcursortype(_NOCURSOR);
+ if (redraw_map)
+ draw_level_map(start_x, start_y, screen_y, travel_mode);
-#ifdef PLAIN_TERM
- gotoxy(1, 1);
-#endif
-
- start_y = screen_y - half_screen;
+ redraw_map = true;
+ gotoxy(curs_x, curs_y);
- for (j = 0; j < num_lines; j++)
- {
- for (i = 0; i < 80; i++)
+ getty = getchm(KC_LEVELMAP);
+ if (getty == 0)
{
- screen_buffer_t colour = DARKGREY;
- if (start_y + j >= 65 || start_y + j <= 3
- || start_x + i < 0 || start_x + i >= GXM - 1)
- {
- buffer2[bufcount2 + 1] = DARKGREY;
- buffer2[bufcount2] = 0;
- bufcount2 += 2;
-
-#ifdef PLAIN_TERM
- goto print_it;
-#endif
+ getty = getchm(KC_LEVELMAP);
+ // [dshaligram] DOS madness.
+ getty = dos_direction_unmunge(getty);
+ }
-#ifdef DOS_TERM
- continue;
+#if defined(WIN32CONSOLE) || defined(DOS)
+ // Translate shifted numpad to shifted vi keys. Yes,
+ // this is horribly hacky.
+ {
+ static int win_keypad[] = { 'B', 'J', 'N',
+ 'H', '5', 'L',
+ 'Y', 'K', 'U' };
+ if (getty >= '1' && getty <= '9')
+ getty = win_keypad[ getty - '1' ];
+ }
#endif
- }
+ switch (getty)
+ {
+ case '?':
+ show_levelmap_help();
+ break;
- colour = colour_code_map(start_x + i, start_y + j,
- Options.item_colour,
- travel_mode && Options.travel_colour);
+ case CONTROL('C'):
+ clear_map();
+ break;
- buffer2[bufcount2 + 1] = colour;
- buffer2[bufcount2] =
- (unsigned char) env.map[start_x + i][start_y + j];
-
- if (start_x + i + 1 == you.x_pos && start_y + j + 1 == you.y_pos)
+ case CONTROL('F'):
+ case CONTROL('W'):
+ travel_cache.add_waypoint(start_x + curs_x, start_y + curs_y);
+ // We need to do this all over again so that the user can jump
+ // to the waypoint he just created.
+ features.clear();
+ find_travel_pos(you.x_pos, you.y_pos, NULL, NULL, &features);
+ // Sort features into the order the player is likely to prefer.
+ arrange_features(features);
+ move_x = move_y = 0;
+ break;
+ case CONTROL('E'):
+ case CONTROL('X'):
{
- // [dshaligram] Draw the @ symbol on the level-map. It's no
- // longer saved into the env.map, so we need to draw it
- // directly.
- buffer2[bufcount2 + 1] = WHITE;
- buffer2[bufcount2] = you.symbol;
- }
+ int x = start_x + curs_x, y = start_y + curs_y;
+ if (getty == CONTROL('X'))
+ toggle_exclude(x, y);
+ else
+ clear_excludes();
- // If we've a waypoint on the current square, *and* the square is
- // a normal floor square with nothing on it, show the waypoint
- // number.
- if (Options.show_waypoints)
- {
- // XXX: This is a horrible hack.
- screen_buffer_t &bc = buffer2[bufcount2];
- int gridx = start_x + i + 1, gridy = start_y + j + 1;
- unsigned char ch = is_waypoint(gridx, gridy);
- if (ch && (bc == get_sightmap_char(DNGN_FLOOR) ||
- bc == get_magicmap_char(DNGN_FLOOR)))
- bc = ch;
+ // We now need to redo travel colours
+ features.clear();
+ find_travel_pos(you.x_pos, you.y_pos, NULL, NULL, &features);
+ // Sort features into the order the player is likely to prefer.
+ arrange_features(features);
+
+ move_x = move_y = 0;
}
+ break;
- bufcount2 += 2;
+ case 'b':
+ case '1':
+ move_x = -1;
+ move_y = 1;
+ break;
-#ifdef PLAIN_TERM
+ case 'j':
+ case '2':
+ move_y = 1;
+ move_x = 0;
+ break;
- print_it:
- // avoid line wrap
- if (i == 79)
- continue;
+ case 'u':
+ case '9':
+ move_x = 1;
+ move_y = -1;
+ break;
- // newline
- if (i == 0 && j > 0)
- gotoxy( 1, j + 1 );
+ case 'k':
+ case '8':
+ move_y = -1;
+ move_x = 0;
+ break;
- int ch = buffer2[bufcount2 - 2];
-#ifdef USE_CURSES
- ch = cset_adjust( ch );
-#endif
- textcolor( buffer2[bufcount2 - 1] );
- putch(ch);
-#endif
- }
- }
+ case 'y':
+ case '7':
+ move_y = -1;
+ move_x = -1;
+ break;
-#ifdef USE_CURSES
- set_altcharset(false);
-#endif
+ case 'h':
+ case '4':
+ move_x = -1;
+ move_y = 0;
+ break;
-#ifdef DOS_TERM
- puttext(1, 1, 80, 25, buffer2);
-#endif
+ case 'n':
+ case '3':
+ move_y = 1;
+ move_x = 1;
+ break;
- _setcursortype(_NORMALCURSOR);
- gotoxy(curs_x, curs_y);
-
- gettything:
- getty = getchm(KC_LEVELMAP);
-
- if (travel_mode && getty != 0 && getty != '+' && getty != '-'
- && getty != 'h' && getty != 'j' && getty != 'k' && getty != 'l'
- && getty != 'y' && getty != 'u' && getty != 'b' && getty != 'n'
- && getty != 'H' && getty != 'J' && getty != 'K' && getty != 'L'
- && getty != 'Y' && getty != 'U' && getty != 'B' && getty != 'N'
- // Keystrokes to initiate travel
- && getty != ',' && getty != '.' && getty != '\r' && getty != ';'
-
- // Keystrokes for jumping to features
- && getty != '<' && getty != '>' && getty != '@' && getty != '\t'
- && getty != '^' && getty != '_'
- && (getty < '0' || getty > '9')
- && getty != CONTROL('X')
- && getty != CONTROL('E')
- && getty != CONTROL('F')
- && getty != CONTROL('W')
- && getty != CONTROL('C')
- && getty != '?'
- && getty != 'X' && getty != 'F' && getty != 'I' && getty != 'W')
- {
- goto putty;
- }
+ case 'l':
+ case '6':
+ move_x = 1;
+ move_y = 0;
+ break;
- if (!travel_mode && getty != 0 && getty != '+' && getty != '-'
- && getty != 'h' && getty != 'j' && getty != 'k' && getty != 'l'
- && getty != 'y' && getty != 'u' && getty != 'b' && getty != 'n'
- && getty != 'H' && getty != 'J' && getty != 'K' && getty != 'L'
- && getty != 'Y' && getty != 'U' && getty != 'B' && getty != 'N'
- && getty != '.' && getty != 'S' && (getty < '0' || getty > '9')
- // Keystrokes for jumping to features
- && getty != '<' && getty != '>' && getty != '@' && getty != '\t'
- && getty != '^' && getty != '_')
- {
- goto gettything;
- }
+ case 'B':
+ move_x = -block_step;
+ move_y = block_step;
+ break;
- if (getty == 0)
- {
- getty = getchm(KC_LEVELMAP);
- // [dshaligram] DOS madness.
- getty = dos_direction_unmunge(getty);
- }
+ case 'J':
+ move_y = block_step;
+ move_x = 0;
+ break;
-#if defined(WIN32CONSOLE) || defined(DOS)
- // Translate shifted numpad to shifted vi keys. Yes,
- // this is horribly hacky.
- {
- static int win_keypad[] = { 'B', 'J', 'N',
- 'H', '5', 'L',
- 'Y', 'K', 'U' };
- if (getty >= '1' && getty <= '9')
- getty = win_keypad[ getty - '1' ];
- }
-#endif
+ case 'U':
+ move_x = block_step;
+ move_y = -block_step;
+ break;
- switch (getty)
- {
- case '?':
- show_levelmap_help();
- break;
-
- case CONTROL('C'):
- clear_map();
- break;
-
- case CONTROL('F'):
- case CONTROL('W'):
- travel_cache.add_waypoint(start_x + curs_x, start_y + curs_y);
- // We need to do this all over again so that the user can jump
- // to the waypoint he just created.
- features.clear();
- find_travel_pos(you.x_pos, you.y_pos, NULL, NULL, &features);
- // Sort features into the order the player is likely to prefer.
- arrange_features(features);
- move_x = move_y = 0;
- break;
- case CONTROL('E'):
- case CONTROL('X'):
+ case 'K':
+ move_y = -block_step;
+ move_x = 0;
+ break;
+
+ case 'Y':
+ move_y = -block_step;
+ move_x = -block_step;
+ break;
+
+ case 'H':
+ move_x = -block_step;
+ move_y = 0;
+ break;
+
+ case 'N':
+ move_y = block_step;
+ move_x = block_step;
+ break;
+
+ case 'L':
+ move_x = block_step;
+ move_y = 0;
+ break;
+
+ case '+':
+ move_y = 20;
+ move_x = 0;
+ break;
+ case '-':
+ move_y = -20;
+ move_x = 0;
+ break;
+ case '<':
+ case '>':
+ case '@':
+ case '\t':
+ case '^':
+ case '_':
+ case 'X':
+ case 'F':
+ case 'W':
+ case 'I':
+ case '*':
+ case '/':
+ case '\'':
{
- int x = start_x + curs_x, y = start_y + curs_y;
- if (getty == CONTROL('X'))
- toggle_exclude(x, y);
- else
- clear_excludes();
+ bool forward = true;
- // We now need to redo travel colours
- features.clear();
- find_travel_pos(you.x_pos, you.y_pos, NULL, NULL, &features);
- // Sort features into the order the player is likely to prefer.
- arrange_features(features);
+ if (getty == '/' || getty == ';')
+ forward = false;
- move_x = move_y = 0;
- }
- break;
-
- case 'b':
- case '1':
- move_x = -1;
- move_y = 1;
- break;
-
- case 'j':
- case '2':
- move_y = 1;
- move_x = 0;
- break;
-
- case 'u':
- case '9':
- move_x = 1;
- move_y = -1;
- break;
-
- case 'k':
- case '8':
- move_y = -1;
- move_x = 0;
- break;
-
- case 'y':
- case '7':
- move_y = -1;
- move_x = -1;
- break;
-
- case 'h':
- case '4':
- move_x = -1;
- move_y = 0;
- break;
-
- case 'n':
- case '3':
- move_y = 1;
- move_x = 1;
- break;
-
- case 'l':
- case '6':
- move_x = 1;
- move_y = 0;
- break;
-
- case 'B':
- move_x = -block_step;
- move_y = block_step;
- break;
-
- case 'J':
- move_y = block_step;
- move_x = 0;
- break;
-
- case 'U':
- move_x = block_step;
- move_y = -block_step;
- break;
-
- case 'K':
- move_y = -block_step;
- move_x = 0;
- break;
-
- case 'Y':
- move_y = -block_step;
- move_x = -block_step;
- break;
-
- case 'H':
- move_x = -block_step;
- move_y = 0;
- break;
-
- case 'N':
- move_y = block_step;
- move_x = block_step;
- break;
-
- case 'L':
- move_x = block_step;
- move_y = 0;
- break;
-
- case '+':
- move_y = 20;
- move_x = 0;
- break;
- case '-':
- move_y = -20;
- move_x = 0;
- break;
- case '<':
- case '>':
- case '@':
- case '\t':
- case '^':
- case '_':
- case 'X':
- case 'F':
- case 'W':
- case 'I':
- move_x = 0;
- move_y = 0;
- if (anchor_x == -1) {
- anchor_x = start_x + curs_x - 1;
- anchor_y = start_y + curs_y - 1;
- }
- if (search_feat != getty) {
- search_feat = getty;
- search_found = 0;
+ if (getty == '/' || getty == ';' || getty == ';' || getty == '\'')
+ getty = 'I';
+
+ move_x = 0;
+ move_y = 0;
+ if (anchor_x == -1) {
+ anchor_x = start_x + curs_x - 1;
+ anchor_y = start_y + curs_y - 1;
+ }
+ if (search_feat != getty) {
+ search_feat = getty;
+ search_found = 0;
+ }
+ if (travel_mode)
+ search_found = find_feature(features, getty, curs_x, curs_y,
+ start_x, start_y,
+ search_found,
+ &move_x, &move_y,
+ forward);
+ else
+ search_found = find_feature(getty, curs_x, curs_y,
+ start_x, start_y,
+ anchor_x, anchor_y,
+ search_found, &move_x, &move_y);
+ break;
}
- if (travel_mode)
- search_found = find_feature(features, getty, curs_x, curs_y,
- start_x, start_y,
- search_found, &move_x, &move_y);
- else
- search_found = find_feature(getty, curs_x, curs_y,
- start_x, start_y,
- anchor_x, anchor_y,
- search_found, &move_x, &move_y);
- break;
- case '.':
- case '\r':
- case 'S':
- case ',':
- case ';':
- {
- int x = start_x + curs_x, y = start_y + curs_y;
- if (travel_mode && x == you.x_pos && y == you.y_pos)
+ case '.':
+ case '\r':
+ case 'S':
+ case ',':
+ case ';':
{
- if (you.travel_x > 0 && you.travel_y > 0) {
- move_x = you.travel_x - x;
- move_y = you.travel_y - y;
+ int x = start_x + curs_x, y = start_y + curs_y;
+ if (travel_mode && x == you.x_pos && y == you.y_pos)
+ {
+ if (you.travel_x > 0 && you.travel_y > 0) {
+ move_x = you.travel_x - x;
+ move_y = you.travel_y - y;
+ }
+ break;
+ }
+ else {
+ spec_place[0] = x;
+ spec_place[1] = y;
+ map_alive = false;
+ break;
}
- break;
}
- else {
- spec_place[0] = x;
- spec_place[1] = y;
- goto putty;
+ default:
+ move_x = 0;
+ move_y = 0;
+ if (travel_mode)
+ {
+ map_alive = false;
+ break;
+ }
+ redraw_map = false;
+ continue;
}
- }
- default:
- move_x = 0;
- move_y = 0;
- break;
- }
- if (curs_x + move_x < 1 || curs_x + move_x > 80)
- move_x = 0;
+ if (!map_alive)
+ break;
+
+ if (curs_x + move_x < 1 || curs_x + move_x > 80)
+ move_x = 0;
- curs_x += move_x;
+ curs_x += move_x;
- if (num_lines < map_lines)
- {
- // Scrolling only happens when we don't have a large enough
- // display to show the known map.
- if (getty == '-' || getty == '+')
+ if (num_lines < map_lines)
{
- if (getty == '-')
- screen_y -= 20;
+ // Scrolling only happens when we don't have a large enough
+ // display to show the known map.
+ if (getty == '-' || getty == '+')
+ {
+ if (getty == '-')
+ screen_y -= 20;
- if (screen_y <= min_y + half_screen)
- screen_y = min_y + half_screen;
+ if (screen_y <= min_y + half_screen)
+ screen_y = min_y + half_screen;
- if (getty == '+')
- screen_y += 20;
+ if (getty == '+')
+ screen_y += 20;
- if (screen_y >= max_y - half_screen)
- screen_y = max_y - half_screen;
+ if (screen_y >= max_y - half_screen)
+ screen_y = max_y - half_screen;
- goto put_screen;
- }
+ continue;
+ }
- if (curs_y + move_y < 1)
- {
- // screen_y += (curs_y + move_y) - 1;
- screen_y += move_y;
+ if (curs_y + move_y < 1)
+ {
+ // screen_y += (curs_y + move_y) - 1;
+ screen_y += move_y;
- if (screen_y < min_y + half_screen) {
- move_y = screen_y - (min_y + half_screen);
- screen_y = min_y + half_screen;
+ if (screen_y < min_y + half_screen) {
+ move_y = screen_y - (min_y + half_screen);
+ screen_y = min_y + half_screen;
+ }
+ else
+ move_y = 0;
}
- else
- move_y = 0;
- }
- if (curs_y + move_y > num_lines - 1)
- {
- // screen_y += (curs_y + move_y) - num_lines + 1;
- screen_y += move_y;
+ if (curs_y + move_y > num_lines - 1)
+ {
+ // screen_y += (curs_y + move_y) - num_lines + 1;
+ screen_y += move_y;
- if (screen_y > max_y - half_screen) {
- move_y = screen_y - (max_y - half_screen);
- screen_y = max_y - half_screen;
+ if (screen_y > max_y - half_screen) {
+ move_y = screen_y - (max_y - half_screen);
+ screen_y = max_y - half_screen;
+ }
+ else
+ move_y = 0;
}
- else
- move_y = 0;
}
- }
- if (curs_y + move_y < 1 || curs_y + move_y > num_lines)
- move_y = 0;
+ if (curs_y + move_y < 1 || curs_y + move_y > num_lines)
+ move_y = 0;
- curs_y += move_y;
- goto put_screen;
-
- putty:
+ curs_y += move_y;
+ }
#ifdef DOS_TERM
puttext(1, 1, 80, 25, buffer);