From: David Griffith Date: Tue, 17 Jan 2012 00:47:03 +0000 (-0800) Subject: SDL Frotz at least compiles now. Fix the complaints and maybe it'll run. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=5f6cce75153bd8f0be7a97326e7e56e7e7317a44;p=liskon_frotz.git SDL Frotz at least compiles now. Fix the complaints and maybe it'll run. --- diff --git a/src/common/err.c b/src/common/err.c index 6978044..49cb13b 100644 --- a/src/common/err.c +++ b/src/common/err.c @@ -19,6 +19,7 @@ */ #include "frotz.h" +f_setup_t f_setup; /* Define stuff for stricter Z-code error checking, for the generic Unix/DOS/etc terminal-window interface. Feel free to change the way diff --git a/src/common/frotz.h b/src/common/frotz.h index 1d078b4..7c7f45e 100644 --- a/src/common/frotz.h +++ b/src/common/frotz.h @@ -45,6 +45,30 @@ enum story { UNKNOWN }; +/*** screen window ***/ + +typedef struct { + zword y_pos; + zword x_pos; + zword y_size; + zword x_size; + zword y_cursor; + zword x_cursor; + zword left; + zword right; + zword nl_routine; + zword nl_countdown; + zword style; + zword colour; + zword font; + zword font_size; + zword attribute; + zword line_count; + zword true_fore; + zword true_back; +} Zwindow; + + #include "setup.h" typedef unsigned char zchar; @@ -674,6 +698,11 @@ void branch (bool); void storeb (zword, zbyte); void storew (zword, zword); + + /*** returns the current window ***/ +Zwindow * curwinrec( void); + + /*** Interface functions ***/ void os_beep (int); diff --git a/src/common/screen.c b/src/common/screen.c index d12ab3a..0de4de9 100644 --- a/src/common/screen.c +++ b/src/common/screen.c @@ -49,24 +49,9 @@ static bool cursor = TRUE; static int input_window = 0; -static struct { - zword y_pos; - zword x_pos; - zword y_size; - zword x_size; - zword y_cursor; - zword x_cursor; - zword left; - zword right; - zword nl_routine; - zword nl_countdown; - zword style; - zword colour; - zword font; - zword font_size; - zword attribute; - zword line_count; -} wp[8], *cwp; +static Zwindow wp[8], *cwp = wp; + +Zwindow * curwinrec() { return cwp;} /* @@ -1742,3 +1727,91 @@ void z_window_style (void) update_attributes (); }/* z_window_style */ + +/* + * get_window_colours + * + * Get the colours for a given window. + * + */ + +void get_window_colours (zword win, zbyte* fore, zbyte* back) +{ + + *fore = lo (wp[win].colour); + *back = hi (wp[win].colour); + +}/* get_window_colours */ + +/* + * get_window_font + * + * Get the font for a given window. + * + */ + +zword get_window_font (zword win) +{ + zword font = wp[win].font; + + if (font == TEXT_FONT) + + if (h_version != V6) { + + if (win != 0 || h_flags & FIXED_FONT_FLAG) + + font = FIXED_WIDTH_FONT; + + } else { + + if (wp[win].style & FIXED_WIDTH_STYLE) + + font = FIXED_WIDTH_FONT; + + } + + return font; + +}/* get_window_font */ + +/* + * colour_in_use + * + * Check if a colour is set in any window. + * + */ + +int colour_in_use (zword colour) +{ + int max = (h_version == V6) ? 8 : 2; + int i; + + for (i = 0; i < max; i++) { + + zword bg = hi (wp[i].colour); + zword fg = lo (wp[i].colour); + + if (colour == fg || colour == bg) + return 1; + + + } + + return 0; + +}/* colour_in_use */ + +/* + * get_current_window + * + * Get the currently active window. + * + */ + +zword get_current_window (void) +{ + + return cwp - wp; + +}/* get_current_window */ + diff --git a/src/sdl/sf_frotz.h b/src/sdl/sf_frotz.h index d0dbc77..3d356b3 100644 --- a/src/sdl/sf_frotz.h +++ b/src/sdl/sf_frotz.h @@ -249,7 +249,7 @@ struct CONVstruct { /*** screen window ***/ - +/* typedef struct { zword y_pos; zword x_pos; @@ -270,4 +270,4 @@ typedef struct { zword true_fore; zword true_back; } Zwindow; - +*/ diff --git a/src/sdl/sf_resource.c b/src/sdl/sf_resource.c index 46debc2..d723c27 100644 --- a/src/sdl/sf_resource.c +++ b/src/sdl/sf_resource.c @@ -8,10 +8,13 @@ #include #include "sf_frotz.h" - #include "../blorb/blorb.h" #include "../blorb/blorblow.h" +zword hx_flags; +zword hx_fore_colour; +zword hx_back_colour; + // various data bool m_tandy = 0; @@ -1013,3 +1016,22 @@ static FILE * findfromlist( int ispic, int num, int *size) return f; } +void os_init_setup(void) +{ + f_setup.attribute_assignment = 0; + f_setup.attribute_testing = 0; + f_setup.context_lines = 0; + f_setup.object_locating = 0; + f_setup.object_movement = 0; + f_setup.left_margin = 0; + f_setup.right_margin = 0; + f_setup.ignore_errors = 0; + f_setup.piracy = 0; /* enable the piracy opcode */ + f_setup.undo_slots = MAX_UNDO_SLOTS; + f_setup.expand_abbreviations = 0; + f_setup.script_cols = 80; + f_setup.save_quetzal = 1; + f_setup.sound = 1; + f_setup.err_report_mode = ERR_DEFAULT_REPORT_MODE; + +}