static void set_window (zword win) { flush_buffer (); cwin = win; cwp = wp + win; update_attributes (); if (h_version == V6) { os_set_colour (lo (cwp->colour), hi (cwp->colour)); if (os_font_data (cwp->font, &font_height, &font_width)) os_set_font (cwp->font); os_set_text_style (cwp->style); } else refresh_text_style (); if (h_version != V6 && win != 0) { wp[win].y_cursor = 1; wp[win].x_cursor = 1; } update_cursor (); }/* set_window */
void z_set_font (void) { zword win = (h_version == V6) ? cwin : 0; zword font = zargs[0]; if (font != 0) { if (os_font_data (font, &font_height, &font_width)) { store (wp[win].font); wp[win].font = font; wp[win].font_size = (font_height << 8) | font_width; if (!ostream_memory && ostream_screen && enable_buffering) { print_char (ZC_NEW_FONT); print_char (font); } else os_set_font (font); } else store (0); } else store (wp[win].font); }/* z_set_font */
void restart_screen (void) { /* Use default settings */ os_set_colour (h_default_foreground, h_default_background); if (os_font_data (TEXT_FONT, &font_height, &font_width)) os_set_font (TEXT_FONT); os_set_text_style (0); cursor = TRUE; /* Initialise window properties */ mwin = 1; for (cwp = wp; cwp < wp + 8; cwp++) { cwp->y_pos = 1; cwp->x_pos = 1; cwp->y_size = 0; cwp->x_size = 0; cwp->y_cursor = 1; cwp->x_cursor = 1; cwp->left = 0; cwp->right = 0; cwp->nl_routine = 0; cwp->nl_countdown = 0; cwp->style = 0; cwp->colour = (h_default_background << 8) | h_default_foreground; cwp->font = TEXT_FONT; cwp->font_size = (font_height << 8) | font_width; cwp->attribute = 8; cwp->true_fore = hx_fore_colour; cwp->true_back = hx_back_colour; } /* Prepare lower/upper windows and status line */ wp[0].attribute = 15; wp[0].left = option_left_margin; wp[0].right = option_right_margin; wp[0].x_size = h_screen_width; wp[1].x_size = h_screen_width; if (h_version <= V3) wp[7].x_size = h_screen_width; os_restart_game (RESTART_WPROP_SET); /* Clear the screen, unsplit it and select window 0 */ erase_screen ((zword) (-1)); }/* restart_screen */
void resize_screen (void) { if (h_version != V6) { int h = wp[0].y_pos + wp[0].y_size; wp[0].x_size = h_screen_width; wp[1].x_size = h_screen_width; wp[7].x_size = h_screen_width; wp[0].y_size = h_screen_height - wp[1].y_size; if (h_version <= V3) wp[0].y_size -= hi (wp[7].font_size); if (os_font_data (TEXT_FONT, &font_height, &font_width)) { int i; for (i = 0; i < 8; i++) wp[i].font_size = (font_height << 8) | font_width; } if (cwin == 0) { int lines = wp[0].y_cursor + font_height - wp[0].y_size - 1; if (lines > 0) { if (lines % font_height != 0) lines += font_height; lines /= font_height; if (wp[0].y_cursor > (font_height * lines)) { os_scroll_area (wp[0].y_pos, wp[0].x_pos, h - 1, wp[0].x_pos + wp[0].x_size - 1, font_height * lines); wp[0].y_cursor -= (font_height * lines); update_cursor (); } } } os_window_height (0, wp[0].y_size); } }/* resize_screen */
void z_set_font (void) { zword font = zargs[0]; zword win = 0; if (h_version == V6) { if (zargc < 2 || (short) zargs[1] == -3) win = cwin; else if (zargs[1] >= 8) runtime_error (ERR_ILL_WIN); else win = zargs[1]; } if (font != 0) { if (os_font_data (font, &font_height, &font_width)) { store (wp[win].font); wp[win].font = font; wp[win].font_size = (font_height << 8) | font_width; if ((h_version != V6) || (win == cwin)) { if (!ostream_memory && ostream_screen && enable_buffering) { print_char (ZC_NEW_FONT); print_char (font); } else os_set_font (font); } } else store (0); } else store (wp[win].font); }/* z_set_font */