extern void seed_random (int);
extern void restart_screen (void);
+extern void resize_screen (void);
extern void refresh_text_style (void);
extern void call (zword, int, zword *, int);
extern void split_window (zword);
static int getcolor(char *);
static int getbool(char *);
-/* static void sigwinch_handler(int); */
+static void sigwinch_handler(int);
static void sigint_handler(int);
-/* static void redraw(void); */
-
#define INFORMATION "\
An interpreter for all Infocom and other Z-Machine games.\n\
static int getbool(char *);
static int getcolor(char *);
static int geterrmode(char *);
-/* static void redraw(void); */
/* static FILE *pathopen(const char *, const char *, const char *, char *); */
*
*/
-/*
- if (signal(SIGWINCH, SIG_IGN) != SIG_IGN)
+
+// if (signal(SIGWINCH, SIG_IGN) != SIG_IGN)
signal(SIGWINCH, sigwinch_handler);
-*/
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, sigint_handler);
* cleanly resize the window.
*
*/
-// FIXME: figure out what to do with this
-//static void sigwinch_handler(int UNUSED(sig))
-//{
-/*
-There are some significant problems involved in getting resizes to work
-properly with at least this implementation of the Z Machine and probably
-the Z-Machine standard itself. See the file BUGS for a detailed
-explaination for this. Because of this trouble, this function currently
-does nothing.
-*/
-//}
+static void sigwinch_handler(int UNUSED(sig))
+{
+ signal(SIGWINCH, SIG_IGN);
+ unix_resize_display();
+ signal(SIGWINCH, sigwinch_handler);
+}
/*
exit(1);
}
-/*
-void redraw(void)
-{
-}
-*/
void os_init_setup(void)
{
#include "ux_frotz.h"
+extern void resize_screen(void);
+extern void restart_header(void);
/*
* os_erase_area
else if (units < 0)
os_erase_area(top + 1, left + 1, top - units, right + 1, 0);
}/* os_scroll_area */
+
+
+/*
+ * unix_resize_display
+ *
+ * Resize the display and redraw.
+ *
+ */
+void unix_resize_display(void)
+{
+ int x, y;
+
+ /* 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) x;
+ h_screen_height = (zword) y;
+ 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 */