#include <vorbis/vorbisfile.h>
#include <libmodplug/modplug.h>
-#define MAX(x,y) ((x)>(y)) ? (x) : (y)
-#define MIN(x,y) ((x)<(y)) ? (x) : (y)
-
enum sound_type {
FORM,
OGGV,
#define PATH1 "ZCODE_PATH"
#define PATH2 "INFOCOM_PATH"
+#define MAX(x,y) ((x)>(y)) ? (x) : (y)
+#define MIN(x,y) ((x)<(y)) ? (x) : (y)
/* Some regular curses (not ncurses) libraries don't do this correctly. */
#ifndef getmaxyx
/*** Functions specific to the Unix port of Frotz ***/
bool unix_init_pictures(void); /* ux_pic.c */
-bool unix_init_pictures(void); /* ux_pic.c */
-void unix_init_scrollback(void); /* ux_screen.c */
-void unix_save_screen(int); /* ux_screen.c */
-void unix_do_scrollback(void); /* ux_screen.c */
+/* void unix_init_scrollback(void); /* ux_screen.c */
+/* void unix_save_screen(int); /* ux_screen.c */
+/* void unix_do_scrollback(void); /* ux_screen.c */
void unix_resize_display(void); /* ux_screen.c */
+void unix_get_terminal_size(void); /* ux_init.c */
#ifdef NO_STRRCHR
}/* os_process_arguments */
+void unix_get_terminal_size()
+{
+ int y, x;
+ getmaxyx(stdscr, y, x);
+
+ if (u_setup.screen_height != -1)
+ h_screen_rows = u_setup.screen_height;
+ else
+ /* 255 disables paging entirely. */
+ h_screen_rows = MIN(254, y);
+
+ if (u_setup.screen_width != -1)
+ h_screen_cols = u_setup.screen_width;
+ else
+ h_screen_cols = MIN(255, x);
+
+ if (h_screen_cols < 1)
+ os_fatal("Invalid screen width. Must be between 1 and 255.");
+
+ h_font_width = 1;
+ h_font_height = 1;
+
+ h_screen_width = h_screen_cols;
+ h_screen_height = h_screen_rows;
+}
+
+
/*
* os_init_screen
*
if (f_setup.undo_slots == 0)
h_flags &= ~UNDO_FLAG;
- getmaxyx(stdscr, h_screen_rows, h_screen_cols);
-
- if (u_setup.screen_height != -1)
- h_screen_rows = u_setup.screen_height;
- if (u_setup.screen_width != -1)
- h_screen_cols = u_setup.screen_width;
-
- h_screen_width = h_screen_cols;
- h_screen_height = h_screen_rows;
-
- if (h_screen_width > 255 || h_screen_width < 1)
- os_fatal("Invalid screen width. Must be between 1 and 255.");
-
- h_font_width = 1;
- h_font_height = 1;
+ unix_get_terminal_size();
/* Must be after screen dimensions are computed. */
if (h_version == V6) {
*/
void unix_resize_display(void)
{
-// int x, y;
-
endwin();
refresh();
+ unix_get_terminal_size();
/* Notify the game that the display needs refreshing */
if (h_version == V6)
h_flags |= REFRESH_FLAG;
- /* Get new terminal dimensions */
-// getmaxyx(stdscr, y, x);
-
- /* Update the game's header */
- h_screen_width = (zword) COLS;
- h_screen_height = (zword) LINES;
- h_screen_cols = (zbyte) (h_screen_width / h_font_width);
- h_screen_rows = (zbyte)(h_screen_height / h_font_height);
-
if (zmp != NULL) {
resize_screen();
restart_header();
}
-
-// clearok(stdscr, 1);
-// redrawwin(stdscr);
-// refresh();
-// clearok(stdscr, 0);
-
}/* unix_redraw_display */