/* * screen_word * * Display a string of characters on the screen. If the word doesn't fit * then use wrapping or clipping depending on the current setting of the * enable_wrapping flag. * */ void screen_word (const zchar *s) { int width; if (discarding) return; if (*s == ZC_INDENT && cwp->x_cursor != cwp->left + 1) screen_char (*s++); if (units_left () < (width = os_string_width (s))) { if (!enable_wrapping) { zchar c; while ((c = *s++) != 0) if (c == ZC_NEW_FONT || c == ZC_NEW_STYLE) { int arg = (int) *s++; if (c == ZC_NEW_FONT) os_set_font (arg); if (c == ZC_NEW_STYLE) os_set_text_style (arg); } else screen_char (c); return; } if (*s == ' ' || *s == ZC_INDENT || *s == ZC_GAP) width = os_string_width (++s); #ifdef AMIGA if (cwin == 0) Justifiable (); #endif screen_new_line (); } os_display_string (s); cwp->x_cursor += width; }/* screen_word */
void screen_write_input (const zchar *buf, zchar key) { int width; if (units_left () < (width = os_string_width (buf))) screen_new_line (); os_display_string (buf); cwp->x_cursor += width; if (key == ZC_RETURN) screen_new_line (); }/* screen_write_input */
zchar console_read_input (int max, zchar *buf, zword timeout, bool continued) { zchar key; int i; /* Make sure there is some space for input */ if (cwin == 0 && units_left () + os_string_width (buf) < 10 * font_width) screen_new_line (); /* Make sure the input line is visible */ if (continued && input_redraw) screen_write_input (buf, -1); input_window = cwin; input_redraw = FALSE; /* Get input line from IO interface */ cwp->x_cursor -= os_string_width (buf); key = os_read_line (max, buf, timeout, units_left (), continued); cwp->x_cursor += os_string_width (buf); if (key != ZC_TIME_OUT) for (i = 0; i < 8; i++) wp[i].line_count = 0; /* Add a newline if the input was terminated normally */ if (key == ZC_RETURN) screen_new_line (); return key; }/* console_read_input */
void memory_word (const zword *s) { zword size; zword addr; zword c; if (h_version == V6) { int width = os_string_width (s); if (redirect[depth].xsize != 0xffff) if (redirect[depth].width + width > redirect[depth].xsize) { if (*s == ' ' || *s == ZC_INDENT || *s == ZC_GAP) width = os_string_width (++s); memory_new_line (); } redirect[depth].width += width; } addr = redirect[depth].table; LOW_WORD (addr, size) addr += 2; while ((c = *s++) != 0) storeb ((zword) (addr + (size++)), translate_to_zscii (c)); storew (redirect[depth].table, size); }/* memory_word */
/* * screen_erase_input * * Remove an input line that has already been printed from the screen * as if it was deleted by the player. This could be necessary during * playback. * */ void screen_erase_input (const zchar *buf) { if (buf[0] != 0) { int width = os_string_width (buf); zword y; zword x; cwp->x_cursor -= width; y = cwp->y_pos + cwp->y_cursor - 1; x = cwp->x_pos + cwp->x_cursor - 1; os_erase_area (y, x, y + font_height - 1, x + width - 1, -1); os_set_cursor (y, x); } }/* screen_erase_input */